Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
String() vs .toString() vs Concatenation vs Template string
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Browser:
Chrome 126
Operating system:
Linux
Device Platform:
Desktop
Date tested:
2 years ago
Template string
2.4M/s
Concatenation
2.4M/s
.toString()
803K/s
String()
67K/s
View exact numbers
Test name
Executions per second
✓
Template string
2,374,346 Ops/sec
Concatenation
2,358,854 Ops/sec
.toString()
803,413 Ops/sec
String()
66,786 Ops/sec
Tests:
String()
let num = 500; let nums = []; for(let i = 0; i < 100; ++i) { nums.push(String(num)); }
.toString()
let num = 500; let nums = []; for(let i = 0; i < 100; ++i) { nums.push(num.toString()); }
Concatenation
let num = 500; let nums = []; for(let i = 0; i < 100; ++i) { nums.push(''+num); }
Template string
let num = 500; let nums = []; for(let i = 0; i < 100; ++i) { nums.push(`${num}`); }