Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
foreach vs objects
foreach
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/123.0.0.0 Safari/537.36
Browser:
Chrome 123
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
1
20361944.0 Ops/sec
2
19219984.0 Ops/sec
Tests:
1
const abcd = []; const a = { name: 'name 1', income: 123, gap: 500, gapProportion: 0.2 }; const b = { name: 'name 1', income: 123, gap: 500, gapProportion: 0.2 }; const c = { name: 'name 1', income: 123, gap: 500, gapProportion: 0.2 }; const d = { name: 'name 1', income: 123, gap: 500, gapProportion: 0.2 }; abcd.push(a); abcd.push(b); abcd.push(c); abcd.push(d);
2
const abcd = []; const x = [{ name: 'name 1', income: 123, gap: 500, gapProportion: 0.2 }, { name: 'name 1', income: 123, gap: 500, gapProportion: 0.2 }, { name: 'name 1', income: 123, gap: 500, gapProportion: 0.2 }, { name: 'name 1', income: 123, gap: 500, gapProportion: 0.2 }]; x.forEach(el => abcd.push(el));