Created
January 18, 2011 08:27
-
-
Save uhop/784134 to your computer and use it in GitHub Desktop.
Creating simple objects.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Creating simple objects. | |
// our constructors | |
var A = function(){}; | |
var B = function(){}; | |
B.prototype.m = function(){}; | |
var C = function(){ | |
this.p = 42; | |
}; | |
C.prototype.m = function(){}; | |
this.group( | |
"Objects", | |
function EmptyNaked(){ return {}; }, | |
function EmptyObj() { return new Object(); }, | |
function EmptyCtrA() { return new A(); }, | |
function EmptyCtrB() { return new B(); }, | |
function PropNaked() { return {p: 42}; }, | |
function PropCtrC() { return new C(); } | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Benchmark it with http://www.perfjs.com/