Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Boolean constructor vs double negotiation trick in javascript
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0
Browser:
Firefox 124
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Double negation trick
1292.4M/s
Boolean
1287.3M/s
View exact numbers
Test name
Executions per second
✓
Double negation trick
1,292,362,624 Ops/sec
Boolean
1,287,274,752 Ops/sec
Script Preparation code:
var bFalse = false; var sEmpty = ''; var sFilled = 'Foo'; var nZero = 0; var nOne = 1;
Tests:
Boolean
Boolean(bFalse) Boolean(sEmpty) Boolean(sFilled) Boolean(nZero) Boolean(nOne)
Double negation trick
!!bFalse !!sEmpty !!sFilled !!nZero !!nOne