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; rv:137.0) Gecko/20100101 Firefox/137.0
Browser:
Firefox 137
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
For []
4K/s
While If
3K/s
For
2K/s
While
2K/s
Set
675/s
View exact numbers
Test name
Executions per second
✓
For []
3,572 Ops/sec
While If
2,639 Ops/sec
For
2,321 Ops/sec
While
2,254 Ops/sec
Set
675 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()); } }