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:
9 months ago
by:
Guest
Jump 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:
9 months 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
Test name
Executions per second
Set
13915136.0 Ops/sec
For
18029712.0 Ops/sec
While
61211872.0 Ops/sec
Related benchmarks:
Test for
for...of Set vs. array conversion
ASKDFJLASKDFJLASKJDLASKDJFLASKDaS
array pre alloc n
Anonymous Functions Evaluations (IIFE)
set.add test4
js length vs cached length
Array access vs set access
NextTick Implementation in GameLoop
Comments
Confirm delete:
Do you really want to delete benchmark?