3 ms·
Are you sure of that? If I recall correctly from the source an object with N properties typically requires 1 hidden class (for that object). In order for it to
by inglor 9y ago
Are you sure of that? If I recall correctly from the source an object with N properties typically requires 1 hidden class (for that object).
In order for it to require 8 it needs to add properties very dynamically. Am I remembering this wrong?
- ridiculous_fish 9y agoYou can see the description of how hidden classes work on the v8 wiki [1]. The short explanation is that the way v8 finds a hidden class is by following a chain of transitions starting at the empty class. Intermediate classes have to be kept around to retain the transitions. That is, in code like: function Point(x, y) { this.x = x; this.y = y; } v8 retains the hidden class for {x}, so it can find the hidden class for {x, y}. [1] https://github.com/v8/v8/wiki/Design%20Elements#fast-property-access https://github.com/v8/v8/wiki/Design%20Elements#fast-propert...