function calls: apply, call, and arguments

JavaScript performance comparison

Revision 11 of this test case created and last updated

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var Obj = function() {};
    Obj.prototype.f = function() { return this; };
    Obj.prototype.f1 = function() { return this.f(1); };
    Obj.prototype.f2 = function() { return this.f.apply(this, [1]); };
    Obj.prototype.f3 = function() { return this.f.apply(this, arguments); };
   
    var obj = new Obj();
};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
direct
obj.f1();
pending…
apply
obj.f2();
pending…
apply with arguments
obj.f3(1);
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment