Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Native JS: concatenate string with + vs template literals vs String.concat
find best solution for concatenate 4 strings
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0
Browser:
Chrome 120
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
using plus operator
105709.1 Ops/sec
using concat function
91472.9 Ops/sec
using template literals
108618.7 Ops/sec
Script Preparation code:
var name = "name"; var id = "id";
Tests:
using plus operator
for (let i = 0; i < 80; ++i) { let result = id + ": 1, " + name + ": someItem"; }
using concat function
for (let i = 0; i < 80; ++i) { let result = "".concat(id, ": 1, ", name, ": someItem"); }
using template literals
for (let i = 0; i < 80; ++i) { let result = `${id}: 1, ${name}: someItem`; }