Push array onto other (v2)

Revision 2 of this benchmark created on


Setup

const array = [];
const otherArray = Array.from({length: 150000}, () => 123);

Test runner

Ready to run.

Testing in
TestOps/sec
one by one
for (const val of otherArray) {
	array.push(val)
}
ready
chunks 4k
const CHUNK_SIZE = 4096;
for (let i = 0, l = otherArray.length; i < l; i += CHUNK_SIZE) {
	array.push(...otherArray.slice(i, i + CHUNK_SIZE));
}
ready
chunks 8k
const CHUNK_SIZE = 8192;
for (let i = 0, l = otherArray.length; i < l; i += CHUNK_SIZE) {
	array.push(...otherArray.slice(i, i + CHUNK_SIZE));
}
ready
chunks 16k
const CHUNK_SIZE = 16384;
for (let i = 0, l = otherArray.length; i < l; i += CHUNK_SIZE) {
	array.push(...otherArray.slice(i, i + CHUNK_SIZE));
}
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.