Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
NextTick Implementation in GameLoop
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Browser:
Chrome 135
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
For
4K/s
While If
3K/s
While
3K/s
For []
2K/s
Set
718/s
View exact numbers
Test name
Executions per second
✓
For
3,938 Ops/sec
While If
2,718 Ops/sec
While
2,666 Ops/sec
For []
2,392 Ops/sec
Set
718 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const ticks = 1000; const length = 10; let arr = []; const set = new Set();
Tests:
Set
for(let tickCount = 0; tickCount < ticks; tickCount++){ // NextTick for(const c of set){ c(); } set.clear(); // Game for(let i = 0; i < length; i++){ set.add(() => Math.random()); } }
For
for(let tickCount = 0; tickCount < ticks; tickCount++){ // NextTick arr.forEach((c) => c()); arr.length = 0; // Game for(let i = 0; i < length; i++){ arr.push(() => Math.random()); } }
For []
for(let tickCount = 0; tickCount < ticks; tickCount++){ // NextTick arr.forEach((c) => c()); arr = []; // Game for(let i = 0; i < length; i++){ arr.push(() => Math.random()); } }
While
for(let tickCount = 0; tickCount < ticks; tickCount++){ // NextTick while(true){ const c = arr.pop(); if(c === undefined) break; c(); } arr = []; // Game for(let i = 0; i < length; i++){ arr.push(() => Math.random()); } }
While If
for(let tickCount = 0; tickCount < ticks; tickCount++){ if(arr.length){ // NextTick while(true){ const c = arr.pop(); if(c === undefined) break; c(); } arr = []; } // Game for(let i = 0; i < length; i++){ arr.push(() => Math.random()); } }