Closed Bug 83506 Opened 23 years ago Closed 23 years ago

RuleHash::EnumerateTagRules does too much work

Categories

(Core :: CSS Parsing and Computation, defect, P1)

defect

Tracking

()

VERIFIED FIXED
mozilla0.9.2

People

(Reporter: dbaron, Assigned: dbaron)

References

Details

(Keywords: perf)

I'm pretty sure (but check me here) that RuleHash::EnumerateTagRules does more
work than it needs.  It includes rules using the "universal-selector tag", and
calls PseudoEnumFunc on all these rules, and PseudoEnumFunc promptly returns
false since the tag doesn't match (and the comparitor does the same if it's a
-moz-outliner-row pseudo).  PseudoEnumFunc itself (not anything it calls) shows
up significantly in profiles.

I think we can get rid of this, which will remove most of the time spent in
PseudoEnumFunc.  Does this seem right?  I'll post a patch after hyatt lands.
See also my recent comments in bug 83482.
Status: NEW → ASSIGNED
Priority: -- → P1
Target Milestone: --- → mozilla0.9.2
Blocks: 83482
Keywords: perf
OS: Linux → All
We don't select :before and :after with the universal selector. If we did, you'd
see all kinds of weird effects with :before, :after, :first-line and :first-
letter (not to mention :viewport, :canvas et al) with a rule like this:

   * { border: solid 1px lime; padding: 4px; margin: 4px; }

I use that rule all the time without any problems (of this kind).
Hixie, right.  The bug, though, is that we waste time examining all universal 
selector rules, even though they never match a pseudo.
Yup... I wasn't sure before how far we would get, but we only get into the
beginning of PseudoEnumFunc before failing.  But that's still a performance win
at the cost of removing some code. :-)
Hyatt: right, I was answering dbaron's question in bug 83482.
Fix checked in 2001-06-04 18:00 PDT.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Rubber stamp verification. The world still appears sane after the checkin.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.