console.assert (v2)

Revision 2 of this benchmark created on


Description

Is console.assert really slow even the condition is true?

Test runner

Ready to run.

Testing in
TestOps/sec
Test console.assert
for (let i=0; i<10000000; i++) {
	console.assert(i!=1000000);
}
ready
Test homemade assert
function assert(condition,message) {
	if (!condition) {
		console.log(message || "assertion failed");
	}
}
for (let i=0; i<10000000; i++) {
  assert(i!=1000000);
}
ready

Revisions

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