Caching length property vs getting it each time in the loop

save length of the array in the variable vs get it the loop
11 months ago
User agent: Mozilla/5.0 (iPhone14,3; U; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Mobile/19A346 Safari/602.1
Test name Executions per second
123456 123456.0 Ops/sec
123456/**/and+2=2 123456.0 Ops/sec
Script Preparation code:
Tests:
  • Cache length

  • Do not cache

Open this result on MeasureThat.net