Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Fourjunctions Time Complexity
Benchmarking how much time is taken to execute multiple loops and single loops
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36
Browser:
Chrome 133
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Multiple loops
3874.4 Ops/sec
Single loop
79113.7 Ops/sec
Script Preparation code:
const numbers = Array.from({ length: 10_000 }).map(() => Math.random())
Tests:
Multiple loops
const result = numbers .map(n => Math.round(n * 10)) .filter(n => n % 2 === 0) .reduce((a, n) => a + n, 0)
Single loop
const result = numbers.reduce((a, n) => { if (n % 2 === 0) return a; return a + n; }, 0);