Array for vs fill 1e7 (v19)

Revision 19 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Array fill
const A = Array(1e5).fill(0)
for (let i = 0; i < 1e5; i++) {
	A[i] = {name: "Tasos"}
}
ready
Array for
const A = Array(1e5)
for (let i = 0; i < 1e5; i++) {
	A[i] = {name: "Tasos"}
}
ready
new Array for
const A = new Array(1e5)
for (let i = 0; i < 1e5; i++) {
	A[i] = {name: "Tasos"}
}
ready
Array fill map
const A = Array(1e5).fill(0).map(() => {
	return {name: "Tasos"}
});
ready

Revisions

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