Javascript String Concatenation Death Race
Now we have ES6, what is the fastest way to concatenate strings in Javascript? You’ll be surprised too.

Javascript String Concatenation Death Race
Every now and again I get into a discussion with colleagues about the best way to concatenate strings in Javascript. That’s because I live an action packed life.
Developer Alice will say
I think we ought to do it using
s + '_' + i
Developer Bob will argue
That’s so last century, do it using
*s.concat(‘_’).concat(i)*
Then I will come along and say
We live in the time of Node 8 and so we ought to do it using
${s}_${i}
So let’s try them
Test 1. stringLoopAdd.js
const conTrails = (s, i) => s + '_' + i
for (let i = 0; i < 100000000; i++) conTrails('hello world', i)
Test 2. stringLoopConcat.js
const conTrails = (s, i) => s.concat('_').concat(i)
for (let i = 0; i < 100000000; i++) conTrails('hello world', i)
Test 3. stringLoopES6.js
const conTrails = (s, i) => `${s}_${i}`
for (let i = 0; i < 100000000; i++) conTrails('hello world', i)
Results
Test 1
$ time node stringLoopAdd.js
real 8.107s
user 7.316s
sys 1.395s
Test 2
$ time node stringLoopConcat.js
real 12.304s
user 11.436s
sys 1.497s
Test 3
$ time node stringLoopES6.js
real 8.976s
user 8.170s
sys 1.433s
So there you go. string + string + string wins.

[embed]**“Sometimes the old ways are the best.”**
—
Like this but not a subscriber? You can support the author by joining via davesag.medium.com.
메타데이터
- post_id
- a19befc32296
- slug
- javascript-string-concatenation-death-race-a19befc32296
- url
- https://codeburst.io/javascript-string-concatenation-death-race-a19befc32296
- canonical_url
- https://codeburst.io/javascript-string-concatenation-death-race-a19befc32296
- author_url
- https://medium.com/@davesag
- status
- ok
- fetched_at
- 2026-07-24 21:36:43