Test empty function (v2)

Revision 2 of this benchmark created on


Setup

let obj1 = {
    assert: (i) => {if( ! Number.isInteger(i)) throw new Error('nok')}
};
let obj2 = {
    assert: (_i) => {}
};
let obj3 = {
    assert: () => {}
};
let obj4 = {
	assert: null
}

Test runner

Ready to run.

Testing in
TestOps/sec
test
try {
	for(let i = 10000; i < 20000; ++i)
    	obj1.assert(i)
}catch(e) {
	console.log(e)
}
ready
empty assert
try {
	for(let i = 20000; i < 30000; ++i)
    	obj2.assert(i)
} catch(e) {
	console.log(e)
}
ready
no functions
try {
	for(let i = 30000; i < 40000; ++i)
    	if( ! Number.isInteger(i)) throw new Error('nok')
} catch(e) {
	console.log(e)
}
ready
Empty assert2
try {
	for(let i = 40000; i < 50000; ++i)
    	obj3.assert(i)
} catch(e) {
	console.log(e)
}
ready
test null
try {
	for(let i = 60000; i < 70000; ++i)
    	obj1.assert?.(i)
}catch(e) {
	console.log(e)
}
ready
empty assert null
try {
	for(let i = 70000; i < 80000; ++i)
    	obj4.assert?.(i)
} catch(e) {
	console.log(e)
}
ready

Revisions

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