I've been doing a bit of profiling of frame construction, and trying to
figure out ways to optimize all the pseudo-style probing we do right now
(for :before/:after content, for first-line and first-letter, etc).
That stuff takes up up to 25% of frame construction time; the value is
lower if more complicated CSS is used on the page, of course.
Some thoughts that could use sanity-checking:
1) Instead of putting all the pseudo-element rules into a single linked
list per ruleprocessor, we could actually create a separate rulehash per
pseudo-element, or at least for before/after/first-line/first-letter.
Then within this rulehash we hash rules as we normally would. This
means, for example, that when probing ::before we don't have to do
SelectorMatches on all the UA ::before rules we have and can instead
just check against the ones that matter (usually none).
2) In RuleHash::EnumerateAllRules, check entry counts on the tables
before doing lookups. Lookups are not that cheap with pldhash, and
often enough the tables are completely empty (e.g. in the UA level the
id table is empty; in the user level most of the tables are empty by
default, etc).
3) Perhaps combine the rule processor data for the "main" style
resolution and the pseudo-probing, since the latter just uses the same
data with the additional pseudo-tag tossed in.
-Boris
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout