Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
boolean literal comparison vs typeof js
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0
Browser:
Firefox 115
Operating system:
Windows 8.1
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
literal comparison
151485.3 Ops/sec
typeof
197763.7 Ops/sec
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") { } }