Traversal perftest

Benchmark created on


Setup

const f = (n) => s += n

Test runner

Ready to run.

Testing in WebKit 537.36 / undefined
TestOps/sec
map 1M
const a = new Array(1000000).fill(1)
let s = 0
a.map(f)
console.log(s)
ready
generator 1M
const a = new Array(1000000).fill(1)
let s = 0
const g = function*(arr, fn) {
	for(const item of arr) {
		yield(fn(item))
	}
}
g(a, f)
console.log(s)
ready
forEach 1M
const a = new Array(1000000).fill(1)
let s = 0
a.forEach(f)
console.log(s)
ready

Revisions

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