call vs adding to this

Benchmark created on


Preparation HTML

<script>
  function foo() {
   return this.a + this.b;
  }
  
  function bar() {
   return this.a + this.b;
  }
  
  var f = {
   a: 3,
   b: 4
  };
  
  var b = {
   a: 3,
   b: 4
  };
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
.call
var c1 = foo.call(f);
ready
add, call, thn remove
b.bar = bar;
var c2 = b.bar();
b.bar = undefined;
ready

Revisions

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