Closed Bug 83836 Opened 25 years ago Closed 24 years ago

pull out initialization of SelectorMatchesData another level

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla0.9.7

People

(Reporter: dbaron, Assigned: dbaron)

Details

(Keywords: perf, Whiteboard: [whitebox])

Attachments

(1 file, 1 obsolete file)

Right now we initialize the SelectorMatchesData within nsCSSStyleSheetImpl::RulesMatching. We could pull it outside of another loop (into StyleSetImpl::WalkRuleProcessors) at the cost of some modularity. Probably the easiest and the fastest way to do this is just to make the SelectorMatchesData something that's usable by all the stylesheet classes, and not just the CSSStyleSheetImpl. This solution bugs me a bit but it's the only one I can think of. Any other thoughts on how me might do this?
Status: NEW → ASSIGNED
Keywords: perf
Priority: -- → P2
Target Milestone: --- → mozilla0.9.3
Target Milestone: mozilla0.9.3 → Future
How about attaching part of the information to the RuleWalker?
Target Milestone: Future → mozilla0.9.7
Well, I tried to do this, and this patch seems to slow things (i.e., jrgm's tests) down by 10% and also break some cases of view positioning. I guess I have to figure out what I did wrong...
Attached patch working patchSplinter Review
This patch seems to work fine, and gives a 2.3% performance impromevent on jrgm's tests. (The key error in the previous patch was a "!" I didn't want at the beginning of HTMLCSSStyleSheetImpl::RulesMatching(Pseudo...).) In addition to pulling out the initialization of SelectorMatchesData, it: * simplifies the matching of :-moz-bound-element, since the scoped stylesheet handling code now has access to the enumeration data * fixes StyleSetImpl::WalkRuleProcessors to respect the enumerator's request to halt enumeration in most cases, and clarified the difference between WalkRuleProcessors and FileRules. (Perhaps we should use WalkRuleProcessors for AttributeAffectsStyle as well...?)
Attachment #56997 - Attachment is obsolete: true
Attachment #57114 - Flags: superreview+
2.3 percent? you rule! (pun intended) Problem: I get the following assertion quite frequently... null pointer: 'aRuleWalker', file nsCSSStyleSheet.cpp, line 3225
oops. I think I need to move the rule walker assertion into the ContentRuleProcessorData and PseudoRuleProcessorData constructors and not the StateRuleProcessorData constructor. I hadn't done a debug build with these changes yet...
r=waterson, although getting attinasi, fantasai, or pierre to take a look might be a good idea.
Comment on attachment 57114 [details] [diff] [review] working patch r=waterson
Attachment #57114 - Flags: review+
Comment on attachment 57114 [details] [diff] [review] working patch This looks fine to me. Nice job David!
r=pierre with a fix for the assertion. Note: the number of memory allocations at startup did not change (approx 284000) but it is not surprising because the SelectorMatchesData is allocated from an arena, but it means that the 2.3% percent performance improvement comes just from initializating the structure: wow! Any chance we can have it approved 0.9.6?
Fix checked in 2001-11-10 15:51 PDT. I don't think it's worth it for 0.9.6 - 2% isn't noticeable by users -- it's the accumulation of multiple fixes that is noticeable.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
It's interesting to note that the tinderbox stats showed the number of RuleProcessorData constructed only fell by a factor of 2.9. I'm guessing this is because there are many arena-allocated ones at one level of the cascade for some elements (probably for the descendant combinators in html.css / quirk.css).
Hmmm. HP is giving a dynamic linker error at runtime: /usr/lib/dld.sl: Unresolved symbol: typeid__XT17RuleProcessorData_ (data) from /builds/tinderbox/SeaMonkey/HP-UX_B.11.00_Clobber/mozilla/dist/bin/components/libgklayout.sl /usr/lib/dld.sl: Unresolved symbol: __dt__17RuleProcessorDataFv (code) from /builds/tinderbox/SeaMonkey/HP-UX_B.11.00_Clobber/mozilla/dist/bin/components/libgklayout.sl
Well, I fixed the HP linker error by making the destructor for RuleProcessorData non-virtual, which it should have been anyway.
Whiteboard: [whitebox]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: