Closed Bug 335733 Opened 18 years ago Closed 18 years ago

FindChildWithRules should use an MRU cache

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: dbaron, Assigned: dbaron)

Details

(Whiteboard: [patch])

Attachments

(1 file)

There's currently no good reason for nsStyleContext's child lists to be doubly linked.  Furthermore, making them singly linked would force insertion at the beginning of the list, which would make the optimization in FindChildWithRules considerably more useful, I suspect, since it would look at the 10 most recently created children instead of the 10 least.  FindChildWithRules could even promote to the beginning of the list (and could also not have duplicated code for the two child lists).
Well, maybe not -- I wasn't thinking about RemoveChild.  But I'd still like to make FindChildWithRules more effective...
Summary: nsStyleContext child list should be singly linked → FindChildWithRules should use an MRU cache
Attached patch patchSplinter Review
Not yet tested.
Comment on attachment 220064 [details] [diff] [review]
patch

This also condenses a bunch of things that operate either on mChild or mEmptyChild.
Attachment #220064 - Flags: superreview?(bzbarsky)
Attachment #220064 - Flags: review?(bzbarsky)
Status: NEW → ASSIGNED
Priority: -- → P2
Whiteboard: [patch]
Target Milestone: --- → mozilla1.9alpha
Attachment #220064 - Flags: superreview?(bzbarsky)
Attachment #220064 - Flags: superreview+
Attachment #220064 - Flags: review?(bzbarsky)
Attachment #220064 - Flags: review+
Fix checked in to trunk.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: