On Tuesday 2009-02-24 14:51 -0500, Boris Zbarsky wrote:
> 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).

Separating pseudo-element rules would be useful for other things,
such as fixing IsPseudoElement to distinguish between :before (a
pseudo-element) and \:before (an element); see
https://bugzilla.mozilla.org/show_bug.cgi?id=475216#c1 .  But that
requires distinguishing through even more of the process.

Maybe we could somehow have one rule hash for every pseudo-element
for which we actually have rules?  That could avoid getting too
bloated (since in many cases there are no pseudo-element rules).

> 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).

Seems reasonable.

> 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.

Makes sense if it's easy; I haven't looked at how much code it would
require changing.

-David

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout

Reply via email to