1

Benchmark created on


Setup

const TOTAL = 10000000

Test runner

Ready to run.

Testing in
TestOps/sec
for loop
let arr = []

for (let i = 0; i <= TOTAL; i++){
	arr.push(i)
}
ready
new Array
let arr = new Array(TOTAL)

for (let i = 0; i <= TOTAL; i++){
	arr[i] = i
}
ready
new array fill
let arr = new Array(TOTAL).fill(0)

for (let i = 0; i <= TOTAL; i++){
	arr[i] = i
}
ready
random
let arr = []
arr.lenth = TOTAL;

for (let i = 0; i <= TOTAL; i++){
	arr[i] = i
}
ready

Revisions

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