test array len

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Using arr.length in for loop
var a = Array(100000).fill(null)

console.log(`Start for ${a.length}`)
console.time('for')
for (let i = 0; i < a.length; i++) {
    const aElement = a[i];
}
console.timeEnd('for')
ready
Using variable with arr.length in for loop
var a = Array(100000).fill(null)

console.log(`Start for ${a.length}`)
console.time('for')
var len = a.length
for (let i = 0; i < len; i++) {
    const aElement = a[i];
}
console.timeEnd('for')
ready

Revisions

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