Template literals vs array.join vs string concat

Benchmark created by Lucas Gunn on


Test runner

Ready to run.

Testing in
TestOps/sec
Template literals
const first = 'Thing1';
const second = 'Thing2';

const compiled = `${first}_${second}`;
ready
Array.join
const first = 'Thing1';
const second = 'Thing2';

const compiled = [first, second].join('_');
ready
String concat
const first = 'Thing1';
const second = 'Thing2';

const compiled = first + '_' + second;
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by Lucas Gunn on