Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Date toString() vs template
(version: 1)
Comparing performance of:
toString vs template literal
Created:
19 days ago
by:
Guest
Go to the latest result
Tests:
toString
const nums = [] for(let i = 0; i < 1000; ++i) { nums.push(new Date().getFullYear().toString()); }
template literal
const nums = [] for(let i = 0; i < 1000; ++i) { nums.push(`new Date().getFullYear()`); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
toString
template literal
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
19 days ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36
Browser/OS:
Chrome 149 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
template literal
417K/s
toString
20K/s
View exact numbers
Test name
Executions per second
✓
template literal
417,386 Ops/sec
toString
20,454 Ops/sec
Related benchmarks
String() vs .toString() vs template string
String() vs .toString() vs Concatenation vs Template string
String() vs .toString() vs template string (optim)
number to string: String() vs toString() vs template
String() vs .toString() vs template literal
String() vs .toString() vs template literal
Comments
Confirm delete:
Do you really want to delete benchmark?