Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Const vs multiplechecks
(version: 1)
Comparing performance of:
using const vs using multiple checks
Created:
2 months ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
var ANDROID = "android"; var isAndroid = ANDROID === "android";
Tests:
using const
for (let i = 0; i < 50; i++) { const txt = isAndroid ? "a" : "i"; }
using multiple checks
for (let i = 0; i < 50; i++) { const txt = ANDROID === "android" ? "a" : "i"; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
using const
using multiple checks
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:147.0) Gecko/20100101 Firefox/147.0
Browser/OS:
Firefox 147 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
using const
32436750.0 Ops/sec
using multiple checks
32109024.0 Ops/sec
Related benchmarks:
Concatenation vs substring
Concatenation vs Find and Substring
Blaaaaaaaaaaaaaaargh
let vs var
for vs for ... of 2
charCodeAt vs charAt
concast test
testsetas
String indexing vs array indexing for string concatenation
Comments
Confirm delete:
Do you really want to delete benchmark?