v8/v8.dev

there is a mistake in the blog about hidden classes in v8.dev

maoyaru123 opened this issue · 2 comments

I create an object and view its construction in google dev-tools. I found that after an object is created, named properties will still be placed in the object rather than the properties back store when the total named properties are less than 10. However, in this blog, the total number of in-object properties will remain the same all the time after an object was created.

Yes, there's an additional mechanism called "slack tracking" which gives the first few objects of a particular constructor a few spare in-object fields, so that we can learn how many fields tend to be initialised on those objects. Eventually, after a couple of allocations of a constructor, those slack tracked objects are trimmed and the in-object field count is finalized.

This isn't really a "mistake", there's plenty of details like this that these posts have to skip, for the sake of brevity or simplicity. This particular one actually has a whole post of its own: https://v8.dev/blog/slack-tracking

Yes, there's an additional mechanism called "slack tracking" which gives the first few objects of a particular constructor a few spare in-object fields, so that we can learn how many fields tend to be initialised on those objects. Eventually, after a couple of allocations of a constructor, those slack tracked objects are trimmed and the in-object field count is finalized.

This isn't really a "mistake", there's plenty of details like this that these posts have to skip, for the sake of brevity or simplicity. This particular one actually has a whole post of its own: https://v8.dev/blog/slack-tracking

Thank you! Thanks for your reply! Thank Internet!