Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
>0 vs double negotiation trick in javascript
(version: 1)
Comparing performance of:
Boolean vs Double negation trick
Created:
5 months ago
by:
Registered User
Jump to the latest result
Script Preparation code:
var nZero = 0; var nOne = 1;
Tests:
Boolean
for(i=0;i<10000;i++){ console.log(nZero > 0); console.log(nOne > 0); }
Double negation trick
for(i=0;i<10000;i++){ console.log(!!nZero); console.log(!!nOne); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Boolean
Double negation trick
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
5 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36
Browser/OS:
Chrome 142 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Boolean
22.1 Ops/sec
Double negation trick
21.4 Ops/sec
Related benchmarks:
if !== or ===
if !== or === v2
Boolean constructor vs double negotiation trick in javascript
Boolean constructor vs double negotiation trick in javascript - with added single negation test
Boolean constructor vs double negotiation trick in javascript ewsd
Boolean constructor vs double negate vs single negate
Boolean constructor vs double negotiation trick in javascript 2
Boolean constructor vs double negotiation trick in javascript 3
Boolean constructor vs double negotiation trick in javascript(test)
Comments
Confirm delete:
Do you really want to delete benchmark?