hasOwnProperty-caching

Benchmark created by krisk on


Setup

hasOwn = Object.hasOwnProperty;
     Test = function() {}
     Test.prototype = {
       constructor: Test,
       method1: function(){},
       method2: function(){},
       method3: function(){},
       method4: function(){},
       method5: function(){},
       method6: function(){},
       method7: function(){},
       method8: function(){},
       method9: function(){},
       method20: function(){}
     }

Test runner

Ready to run.

Testing in
TestOps/sec
hasOwnProperty
for (var t in Test) {
  if (Test.hasOwnProperty(t)) {
    //
  }
}
ready
hasOwn
for (var t in Test) {
  if (hasOwn.call(Test, t)) {
    //
  }
}
ready

Revisions

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