ES6 String Literals vs. String Concatenation identical test variable (v26)

Revision 26 of this benchmark created on


Description

Benchmark using the same text output

Setup

var precalculatedIso = (new Date()).toISOString();

Test runner

Ready to run.

Testing in
TestOps/sec
ES6 with variable
var test = `<body>
  <article>
    <time datetime='${ precalculatedIso }'>${ precalculatedIso }</time>
  </article>
</body>`;
ready
String concatenation with variable
var test = "<body>\n"+
"  <article>\n"+
"    <time datetime='"+ precalculatedIso +"'>"+ precalculatedIso +"</time>\n"+
"  </article>\n"+
"</body>";
ready
ES6 with function
var test = `<body>
  <article>
    <time datetime='${ (new Date()).toISOString() }'>${ (new Date()).toISOString() }</time>
  </article>
</body>`;
ready
String concatenation with function
var test = "<body>\n"+
"  <article>\n"+
"    <time datetime='"+ (new Date()).toISOString() +"'>"+ (new Date()).toISOString() +"</time>\n"+
"  </article>\n"+
"</body>";
ready

Revisions

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