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:
8 months ago
the + operator
160.4M/s
template literal
141.4M/s
string concat
30.8M/s
array join
17.4M/s
unallocated array join
15.7M/s
View exact numbers
Test name
Executions per second
✓
the + operator
160,425,008 Ops/sec
template literal
141,353,216 Ops/sec
string concat
30,776,770 Ops/sec
array join
17,370,126 Ops/sec
unallocated array join
15,734,859 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(' '); }