On Thu, Nov 27, 2025 at 03:46:37PM -0500, Jeremy Roman wrote: > Curious about the motivation here, beyond switching from a hashtable to an > array. Is the tracing cost that large?
We won ~70 kB of APK size, and 2%+ style performance on some pages. The tracing cost should be roughly the same. (The project was finished last week, and Supplementable is gone.) > It seems like it forces a lot more boilerplate in very central classes and > may make some of them considerably larger because they need space for > members, some of which are nearly always absent. Are you asking about the change from a hashtable to an array, or the change from an array to explicit members? The size (which changed from hashtable to array) diff was generally small, and often negative. The hash table was not free, even less so if you had 1–2 members set and needed to go to a heap allocation. In any case, unused padding in these objects is probably much more significant if we care about the RAM usage in the 2–3 Document objects we have in a typical renderer process. The boilerplate (which changed from array to explicit members) the same as every other getter and setter, so normal Google/Chromium/Blink style. I don't think there's been a push for trying to e.g. add macros to reduce the boilerplate for a typical class, or for that matter, making the members public? I mean, Supplementable comes purely from a desire to be able to embed classes across layers, right? > We have a similar concept outside Blink, in the form of > base::SupportsUserData, for similar reasons (and we presumably wouldn't > want WebContentsImpl to have members for every possible user data it might > have. There are valid reasons for having a sparse structure; in particular, there are things like ElementRareData or NodeData where it genuinely saves memory (and has seen different implementations as we've been tuning things). But we have _lots_ of Elements, so the tradeoff is very different IMO. /* Steinar */ -- Homepage: https://www.sesse.net/ -- You received this message because you are subscribed to the Google Groups "blink-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/3bsiit2tqzmurdcbatsnae7phhnq3jdbicejsdqakb6t6apduy%40d5xts7wyvu3v.
