Artificial vs. Native Bind (v5)

Revision 5 of this benchmark created on


Description

Determine performance gains of native bind. Note: artificial bind doesn't support partial application.

Preparation HTML

<script>
  function artificial_bind(fn, context) {
   return function() {
    return fn.apply(context);
   }
  }

var bind;

if(Function.prototype.bind){
        bind = function(fn, thisObject) {
  return fn.bind.apply(fn, thisObject);
};
}
  function test(arg) {
   var i;
   for (i = 0; i < 1000; i++) {
    arg += i;
   }
   this.lol = arg;

  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Artificial
artificial_bind(test, {})(1337)
ready
Native
bind(test,{})(1337);
ready

Revisions

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