Template strings vs TTL (v4)

Revision 4 of this benchmark created on


Setup

var RUNS = 100;
function ttl(obj, ...args) {
	return String.raw(obj, ...args);
}

Teardown

delete runs;
delete ttl;

Test runner

Ready to run.

Testing in
TestOps/sec
Template string
for (let i = 0; i < RUNS; i++)
	`hello ${'world'}`;
ready
Tagged Template Literal
for (let i = 0; i < RUNS; i++)
	ttl`hello ${'world'}`;
ready
Template string [NESTED]
for (let i = 0; i < RUNS; i++)
	`hello ${'world'} ${`nested ${1}`}`;
ready
Tagged Template Literal [NESTED]
for (let i = 0; i < RUNS; i++)
	ttl`hello ${'world'} ${ttl`nested ${1}`}`;
ready
plus
for (let i = 0; i < RUNS; i++)
	'hello ' + 'world';
ready
plus nested
for (let i = 0; i < RUNS; i++)
  'hello ' + 'world' + 'nested ' + 1;
ready

Revisions

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