Function Declarations vs. Function Expressions (v8)

Revision 8 of this benchmark created on


Preparation HTML

var proto = {init:function(name){this.name = name;return this;}};

function C(){}
C.prototype.init = function(name){this.name = name;}

Test runner

Ready to run.

Testing in
TestOps/sec
Function Declaration
var o = Object.create(proto).init("name");
 
ready
Function Expression
var f = new C();
f.init("name");
ready
Function Expression 2
var o2 = 1;
ready

Revisions

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