Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Concat vs push(...) for large arrays 223123
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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36
Browser:
Chrome 133
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Spread
1.6M/s
Control (for push)
415K/s
Spread 2
54K/s
Concat
744/s
View exact numbers
Test name
Executions per second
✓
Spread
1,555,968 Ops/sec
Control (for push)
414,745 Ops/sec
Spread 2
53,700 Ops/sec
Concat
744 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);
Concat
window.top.tests.concat = window.top.tests.concat.concat(window.test);
Spread
window.top.tests.spread.push(...window.test);
Spread 2
window.top.tests.spread = [window.top.tests.spread, ...window.test];