map lookup (v2)

Revision 2 of this benchmark created by Igor Minar on


Setup

var protoCache = {};
  var noProtoCache = Object.create(null);
  
  protoCache.foo = 'bar';
  noProtoCache.foo = 'bar';
  
  var hasOwnProperty = Object.prototype.hasOwnProperty;
  var foo = 'foo';
  var baz = 'baz';

Test runner

Ready to run.

Testing in
TestOps/sec
proto hit
protoCache.foo
ready
no-proto hit
noProtoCache.foo
ready
proto miss
protoCache.baz
ready
no-proto miss
noProtoCache.baz
ready
proto hasOwn hit
protoCache.hasOwnProperty(foo)
ready
no-proto hasOwn hit
hasOwnProperty.call(noProtoCache, foo)
ready
proto hasOwn miss
protoCache.hasOwnProperty(baz)
ready
no-proto hasOwn miss
hasOwnProperty.call(noProtoCache, baz)
ready
proto in miss
baz in protoCache
ready
no-proto in miss
baz in noProtoCache
ready
proto in hit
foo in protoCache
ready
no-proto in hit
foo in noProtoCache
ready
proto bracket hit
protoCache[foo]
ready
no-proto bracket hit
noProtoCache[foo]
ready
proto bracket miss
protoCache[baz]
ready
no-proto bracket miss
noProtoCache[baz]
ready

Revisions

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

  • Revision 1: published by Igor Minar on
  • Revision 2: published by Igor Minar on