function calls: direct vs apply vs call

JavaScript performance comparison

Revision 66 of this test case created by

Preparation code

<script>
var obj = {
    foo: function () {
        var len = arguments.length;
        return this.bar;
    },
    bar: 'baz'
};
</script>
    

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
direct
obj.foo(1, 2, 3);
pending…
apply
obj.foo.apply(obj, [1, 2, 3]);
pending…
call
obj.foo.call(obj, 1, 2, 3);
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.

0 Comments