Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Test array concatenation
(version: 0)
Comparing performance of:
warmup1 vs warmup 2 vs foreach push vs concat vs apply vs destructure push
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
function prepare() { const a = []; for (let i = 0; i < 9000; i++) { a.push({ id: 1, displayName: 'displayName', asdasd: 'displayName', displayNamedisplayName: { displayName: 'displayName' } }) } const b = []; for (let i = 0; i < 2000; i++) { b.push({ id: 1, displayName: 'displayName', asdasd: 'displayName', displayNamedisplayName: { displayName: 'displayName' } }) } return { a, b }; }
Tests:
warmup1
const { a, b } = prepare(); a.forEach(aaa => !aaa)
warmup 2
const { a, b } = prepare(); a.forEach(aaa => !aaa)
foreach push
const { a, b } = prepare(); b.forEach(aaa => a.push(aaa))
concat
const { a, b } = prepare(); a.concat(b)
apply
const { a, b } = prepare(); Array.prototype.push.apply(a, b);
destructure push
const { a, b } = prepare(); a.push(...b)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (6)
Previous results
Fork
Test case name
Result
warmup1
warmup 2
foreach push
concat
apply
destructure push
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
Array construct vs array push vs array concat
fill vs push multiple
array spread operator vs concat vs push fix
Array 2000 spread vs concat
Comments
Confirm delete:
Do you really want to delete benchmark?