Test

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Object
function add (v) {
	return v.x + v.y
}

for (let i = 0; i < 10000; i++) {
	add({ x: Math.random(), y: Math.random() })
}
ready
Plain
function add (x, y) {
	return x + y
}

for (let i = 0; i < 10000; i++) {
	add(Math.random(), Math.random())
}
ready
Class
class V {
	constructor (x, y) {
		this.x = x
		this.y = y
	}
}

function add (v) {
	return v.x + v.y
}

for (let i = 0; i < 10000; i++) {
	add(new V(Math.random(), Math.random()))
}
ready

Revisions

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