typeof-prefix-for-property-checks

Benchmark created by seb on


Setup

function wrap(obj) {
    if (obj && obj._wrapped) return obj;
    return {_wrapped: obj};
  }
  
  function wrapFast(obj) {
    if (obj && typeof obj == 'object' && obj._wrapped) return obj;
    return {_wrapped: obj};
  }
  
  var wrapped = wrap( "foo" );

Test runner

Ready to run.

Testing in
TestOps/sec
wrap( "foo" )
wrap( "foo" )
ready
wrapFast( "foo" )
wrapFast( "foo" )
ready
wrapFast( wrapped )
wrapFast( wrapped )
ready

Revisions

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