Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Caching for loop conditions
Comparing performance of with and without caching array length.
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36
Browser:
Chrome 133
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
With cache
679841.9 Ops/sec
Without cache
423597.5 Ops/sec
Script Preparation code:
var arr = [...Array(1000).keys()];
Tests:
With cache
let sum = 0; for (let i = 0, arrLen=arr.length; i < arrLen; i++){ sum = arr[i]; }
Without cache
let sum = 0; for (let i = 0; i < arr.length; i++){ sum = arr[i]; }