some perf bench

Benchmark created on


Preparation HTML


Setup

const messages = {
	x: 'x',
	y: 'y'
}
const intl = {
  format(key, placeholders) {
    const message = messages[key];
  },

  wrapper(...args) {
  	const message = messages[args[0]];
  }
}

function generated1(cb, placeholders) {
    cb('x', placeholders)
}

function generated2(cb, placeholders) {
    cb('y', placeholders)
}

Test runner

Ready to run.

Testing in
TestOps/sec
direct
intl.format('x', { obj: 1})
intl.format('y', { obj: 1})
ready
call
intl.format.call(null, 'x', { obj: 1})
intl.format.call(null, 'y', { obj: 1})
ready
apply
intl.format.call(null, ['x', { obj: 1}])
intl.format.call(null, ['y', { obj: 1}])
ready
wrapper
intl.wrapper('x', { obj: 1})
intl.wrapper('y', { obj: 1})
ready
generated
generated1(intl.format, { obj: 1})
generated2(intl.format, { obj: 1})
ready

Revisions

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