Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
string to number: Number() vs template
(version: 1)
Comparing performance of:
template number vs constructor
Created:
one year ago
by:
Guest
Jump to the latest result
Tests:
template number
let nums = []; for(let i = 0; i < 100; ++i) { nums.push(+`${i}`); }
constructor
let nums = []; for(let i = 0; i < 100; ++i) { nums.push(Number(`${i}`)); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
template number
constructor
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Browser/OS:
Chrome 131 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
template number
2603198.8 Ops/sec
constructor
392756.0 Ops/sec
Related benchmarks:
String() vs .toString() vs template string
String() vs .toString() vs template string vs concat with string
String() vs .toString() vs template string vs. short transform
String() vs .toString() vs template string vs add to string
String() vs .toString() vs template string vs add to string 2
Array length to string
number to string: String() vs toString() vs template
String() vs .toString() vs template literal
number to string: String() vs template
Comments
Confirm delete:
Do you really want to delete benchmark?