Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
template literal vs allocated array.join vs unallocated array.join vs string.concat vs the + operator
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0
Browser:
Chrome 142
Operating system:
Windows
Device Platform:
Desktop
Date tested:
5 months ago
Test name
Executions per second
template literal
141353216.0 Ops/sec
array join
17370126.0 Ops/sec
string concat
30776770.0 Ops/sec
the + operator
160425008.0 Ops/sec
unallocated array join
15734859.0 Ops/sec
Script Preparation code:
var a = 'a'; var b = 'b'; var c = 'c'; var abc = [a,b,c];
Tests:
template literal
for (let n = 0; n < 1000; n++) { return `${a} ${b} ${c}`; }
array join
for (let n = 0; n < 1000; n++) { return abc.join(' '); }
string concat
for (let n = 0; n < 1000; n++) { return ''.concat(a, ' ', b, ' ', c); }
the + operator
for (let n = 0; n < 1000; n++) { return a + ' ' + b + ' ' + c; }
unallocated array join
for (let n = 0; n < 1000; n++) { return [a,b,c].join(' '); }