Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Concat vs push(...) for large arrays 222
Comparing the various ways to append to a large array
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 124
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
Control (for push)
48093.3 Ops/sec
Spread
6283.7 Ops/sec
Script Preparation code:
window.top.tests = {control:[], concat:[], spread:[]}; window.test = (new Array(10)).fill(null); window.cutoff = 5000;
Tests:
Control (for push)
for (let element of window.test) window.top.tests.control.push(element); if (window.top.tests.control.length > window.cutoff) { window.top.tests.control = []; console.log('reset control'); }
Spread
for (let element of window.test) {window.top.tests.spread = [...window.top.tests.spread, element];} if (window.top.tests.spread.length > window.cutoff) { window.top.tests.spread = []; console.log('reset spread'); }