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 edit
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; rv:148.0) Gecko/20100101 Firefox/148.0
Browser:
Firefox 148
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
one month ago
Test name
Executions per second
using plus operator
1341760.1 Ops/sec
using concat function
988589.6 Ops/sec
using template literals
1333836.5 Ops/sec
Script Preparation code:
var name = "name"; var id = "id";
Tests:
using plus operator
for (let i = 0; i < 10; ++i) { let result = id + ": 1, " + name + ": someItem"; }
using concat function
for (let i = 0; i < 10; ++i) { let result = "".concat(id, ": 1, ", name, ": someItem"); }
using template literals
for (let i = 0; i < 10; ++i) { let result = `${id}: 1, ${name}: someItem`; }