Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
collides
(version: 0)
Comparing performance of:
or vs if vs else if
Created:
7 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var x = 0; var y = 0;
Tests:
or
x = Math.floor(Math.random() * 600); y = Math.floor(Math.random() * 600); if (x < 0 || x > 500) { console.log("hit") } if (y < 0 || y > 500) { console.log("hit") }
if
x = Math.floor(Math.random() * 600); y = Math.floor(Math.random() * 600); if (y < 0) { console.log("hit") } if (x < 0) { console.log("hit") } if (x > 500) { console.log("hit") } if (y > 500) { console.log("hit") }
else if
x = Math.floor(Math.random() * 600); y = Math.floor(Math.random() * 600); if (x < 0) { console.log("hit") } else if (x > 500) { console.log("hit") } if (y < 0) { console.log("hit") } else if (y > 500) { console.log("hit") }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
or
if
else if
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
proto vs pattern
Multiply speed test 3
lodash head vs 0
rand test
Negate Number
Comments
Confirm delete:
Do you really want to delete benchmark?