Rashi on Yeshayahu 40:28

the Creator of the earth's far ends...there is no grasping His wisdom - and One who has such strength and such wisdom He knows the thoughts.  Why does He delay your benefit, only to terminate the transgression and to expiate the sin through afflictions.