var bFalse = false;
var sEmpty = '';
var sFilled = 'Foo';
var nZero = 0;
var nOne = 1;
Boolean(bFalse)
Boolean(sEmpty)
Boolean(sFilled)
Boolean(nZero)
Boolean(nOne)
!Boolean(bFalse)
!Boolean(sEmpty)
!Boolean(sFilled)
!Boolean(nZero)
!Boolean(nOne)
Boolean(bFalse)
--enable-precise-memory-info
flag.
Test case name | Result |
---|---|
Boolean | |
double neg with booleans | |
Short case |
Test name | Executions per second |
---|---|
Boolean | 1993671.4 Ops/sec |
double neg with booleans | 1985034.9 Ops/sec |
Short case | 9971725.0 Ops/sec |
I'd be happy to help explain the provided benchmark!
What is being tested?
MeasureThat.net is testing two different approaches for creating Boolean values in JavaScript:
Boolean()
function, e.g., Boolean(bFalse)
.!Boolean(bFalse)
.The benchmark is testing these two approaches with different inputs:
sEmpty
)sFilled = 'Foo'
)Options compared
The two options being compared are:
Boolean()
function)!
operator followed by Boolean()
)