Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
For vs Foreach manu
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/132.0.0.0 Safari/537.36 OPR/117.0.0.0
Browser:
Opera 117
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
FOREACH
20K/s
FOR
2K/s
View exact numbers
Test name
Executions per second
✓
FOREACH
19,819 Ops/sec
FOR
1,535 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
/*your preparation JavaScript code goes here To execute async code during the script preparation, wrap it as function globalMeasureThatScriptPrepareFunction, example:*/ let test = 0; function globalMeasureThatScriptPrepareFunction() { test = Math.random(); } const ar = Array(100000);
Tests:
FOR
for (let i= 0; i < ar.length; i++) { globalMeasureThatScriptPrepareFunction(); }
FOREACH
ar.forEach(() => { globalMeasureThatScriptPrepareFunction(); });