Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Javascript strings 'concat()' vs '+' vs `${}` when appending mulitple strings
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:155.0) Gecko/20100101 Firefox/155.0
Browser:
Firefox 155
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
7 days ago
Benchmark engine:
Benchmark.js
concat()
26K/s
plus_operator
17K/s
Formatstring
15K/s
Mix
11K/s
View exact numbers
Test name
Executions per second
✓
concat()
26,309 Ops/sec
plus_operator
17,400 Ops/sec
Formatstring
15,473 Ops/sec
Mix
11,122 Ops/sec
Script Preparation code:
let str = "Hello";
Tests:
concat()
let combinedConcat = "Start"; for(i = 0; i < 1000; i++) { combinedConcat = combinedConcat.concat(" ", str); } console.log(combinedConcat);
plus_operator
let combinedPlus = "Start"; for(i = 0; i < 1000; i++) { combinedPlus += " " + str; } console.log(combinedPlus);
Mix
let combinedConcatPlus = "Start"; for(i = 0; i < 1000; i++) { combinedConcatPlus = combinedConcatPlus.concat(" " + str); } console.log(combinedConcatPlus);
Formatstring
let combinedFormat = "Start"; for(i = 0; i < 1000; i++) { combinedFormat = `${combinedFormat} ${str}` } console.log(combinedFormat);