? : null VS &&

Benchmark created on


Description

Comparing ... ? ... : null VS ... && ....

Preparation HTML

Comparing ` ... ? ... : null ` VS `... && ....`

Setup

for(let i = 0; i<200000; i++){
	i < 100000 ? console.log(i) : null
}

Teardown

for(let i = 0; i<200000; i++){
	i < 100000 && console.log(i)
}

Test runner

Ready to run.

Testing in
TestOps/sec
T1
for(let i = 0; i<200000; i++){
	i < 100000 ? console.log(i) : null
}
ready
T2
for(let i = 0; i<200000; i++){
	i < 100000 && console.log(i)
}
ready

Revisions

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