Created
February 6, 2015 23:02
-
-
Save kara-ryli/31826051a9b794f4fb7b to your computer and use it in GitHub Desktop.
A tip I picked up from Fluent 2014
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
// V8 initializes memory space for _x and _y | |
// in advance | |
function Klass1() { | |
this._x = null; | |
this._y = null; | |
} | |
var k1 = new Klass1()._x = 'hi'; | |
function Klass2() {} | |
// dynamically defined property converts to a | |
// linked list in memory, making accessing | |
// _x slower | |
var k2 = new Klass2()._x = 'hi'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment