Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
pad start zero
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0
Browser:
Firefox 152
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one month ago
+
1131.6M/s
toString
456.0M/s
View exact numbers
Test name
Executions per second
✓
+
1,131,625,856 Ops/sec
toString
456,013,696 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const hexpad = ['', '0']; let hex = 'odd';
Tests:
template literal
if (hex.length & 1) hex = `0${hex}`;
lookup
hex = hexpad[hex.length & 1] + hex;
ternary
hex = (hex.length & 1 ? '0' : '') + hex;
ternary template literal
hex = `${(hex.length & 1 ? '0' : '')}${hex}`;