Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Native JS: concatenate integer with 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 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Browser:
Chrome 132
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
using plus operator
14745.7 Ops/sec
using concat function
2220.3 Ops/sec
using template literals
14034.2 Ops/sec
Script Preparation code:
const count = 10000;
Tests:
using plus operator
for (let i = 0; i < count; ++i) { let result = i result += 'px'; }
using concat function
for (let i = 0; i < count; ++i) { let result = i result = ''.concat(result, 'px'); }
using template literals
for (let i = 0; i < count; ++i) { let result = i result = `${result}px`; }