Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
boolean literal comparison vs typeof js
(version: 1)
Comparing performance of:
literal comparison vs typeof
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
var count = 1000; var bool = true;
Tests:
literal comparison
for (var i = 0; i <= count; i++) { if (bool === true || bool === false) { } }
typeof
for (var i = 0; i <= count; i++) { if (typeof(bool) === "boolean") { } }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
literal comparison
typeof
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0
Browser/OS:
Firefox 115 on Windows 8.1
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
literal comparison
151485.3 Ops/sec
typeof
197763.7 Ops/sec
Related benchmarks:
Array comparison
!== vs ===
test of equals
= vs <
= vs >
If else vs If and
if and direct call
BUTTTZZZ
typeof == vs typeof ===
Comments
Confirm delete:
Do you really want to delete benchmark?