New function vs Literal in closure

JavaScript performance comparison

Revision 5 of this test case created by pop

Preparation code

<script>
  var f = function() { };
 
  var g = function() { return this; }
</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
New static
new f;
pending…
Call static create
g.call(Object.create(Object.prototype));
pending…
new
new (function() { });
pending…
call create
(function() { return this; }).call(Object.create(Object.prototype));
pending…
call static
g.call({});
pending…
call
(function() { return this; }).call({});
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