Normalize caching size in loop-local variable.

This was present in a bunch of loops, but not all and not consistently. After fixing two, I figured that I would normalize them all under the umbrella of uniformity and being lazy (only lookup up the value once if it never changes).
Merge pull request #1229 from square/jw/be-lazy

Normalize caching size in loop-local variable.