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/119.0.0.0 Safari/537.36
Browser:
Chrome 119
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
using plus operator
178209.1 Ops/sec
using concat function
147910.3 Ops/sec
using template literals
175828.2 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`; }