Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
NextTick Implementation
(version: 1)
Comparing performance of:
Set vs For vs While
Created:
one year ago
by:
Guest
Go to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const length = 100000; const arr = Array.from({length}, () => () => Math.random()); const set = new Set(arr);
Tests:
Set
for(const c of set){ c(); } set.clear();
For
arr.forEach((c) => c()); arr.length = 0;
While
while(true){ const c = arr.pop(); if(c === undefined) break; c(); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Set
For
While
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Browser/OS:
Chrome 135 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
While
61.2M/s
For
18.0M/s
Set
13.9M/s
View exact numbers
Test name
Executions per second
✓
While
61,211,872 Ops/sec
For
18,029,712 Ops/sec
Set
13,915,136 Ops/sec
Related benchmarks
Anonymous Functions Evaluations (IIFE)
Array access vs set access
NextTick Implementation in GameLoop
Comments
Confirm delete:
Do you really want to delete benchmark?