Artificial vs. Native Bind

Benchmark created by gf3 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);
   }
  }
  
  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
test.bind({})(1337)
ready

Revisions

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