Tiny perf tweak by caching a array.length