Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
String() vs .toString() vs template literal
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:153.0) Gecko/20100101 Firefox/153.0
Browser:
Firefox 153
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
2 days ago
String()
6.5M/s
.toString()
6.4M/s
gato
6.4M/s
template literal
2.0M/s
View exact numbers
Test name
Executions per second
✓
String()
6,546,848 Ops/sec
.toString()
6,445,158 Ops/sec
gato
6,405,619 Ops/sec
template literal
2,049,849 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()); }
template literal
let num = 500; let nums = []; for(let i = 0; i < 100; ++i) { nums.push(`${num}`); }
gato
let num = 500; let nums = []; for(let i = 0; i < 100; ++i) { nums.push('' + num); }