One thing that is rarely mentioned is that template literals are pretty much consistently slower than using string literals in JS. So, if you're doing heavy string processing at volume, you're probably better off avoiding template strings.
Nice tool! But I played with it a few times, and the test results actually shows that the performance of the two solutions are almost the same, either for string concatenation or just plain text. In the above two cases, template literals even wins.
I do used to think template literals are slower (it just makes sense, right?), until I came across this blog a few days ago. There are really not so much performance loss, but as the author says, we "don't need to change to backticks later when you need to use a variable", and backticks are great with no need to escape ' or " and allows multi-line strings. So now I would opt for backticks more, unless there are some convincing reasons I shouldn't do so. 😄
Results vary for every one every time 😂 Maybe it's subject to environment or context changes - I don't know. And that's why I don't consider performance as a serious main issue, and the difference of those nanoseconds can almost be ignored in actual projects. 😃
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
One thing that is rarely mentioned is that template literals are pretty much consistently slower than using string literals in JS. So, if you're doing heavy string processing at volume, you're probably better off avoiding template strings.
But most of the time this is just micro optimization.
Nice tool! But I played with it a few times, and the test results actually shows that the performance of the two solutions are almost the same, either for string concatenation or just plain text. In the above two cases, template literals even wins.
I do used to think template literals are slower (it just makes sense, right?), until I came across this blog a few days ago. There are really not so much performance loss, but as the author says, we "don't need to change to backticks later when you need to use a variable", and backticks are great with no need to escape
'or"and allows multi-line strings. So now I would opt for backticks more, unless there are some convincing reasons I shouldn't do so. 😄Interesting - it's almost always 20-30% slower for me, on both Chrome and Firefox
Results vary for every one every time 😂 Maybe it's subject to environment or context changes - I don't know. And that's why I don't consider performance as a serious main issue, and the difference of those nanoseconds can almost be ignored in actual projects. 😃