direct vs call vs apply

Benchmark created by Angus on


Preparation HTML

<script>
  var obj = {
   calc: function(a, b, c) {
    return Math.sqrt((a * b / c) + 10);
   }
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
direct
obj.calc();
ready
call
obj.calc.call(obj, 5, 8, 7);
ready
apply
obj.calc.apply(obj, [5, 8, 7]);
ready

Revisions

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