If an array has a fixed length, then cache it

Instead of this:

Cache the length. It's not going to change: