Open Bug 528128 Opened 16 years ago Updated 3 years ago

Consider caching nsRuleData* on rulenodes, especially for inherit structs

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

Tracking Status
blocking2.0 --- -

People

(Reporter: bzbarsky, Unassigned)

Details

(Keywords: perf, student-project)

Right now we cache nsStyle* on rulenodes in various cases, but those cases are not hit all that often for inherit structs (nsStyleColor excepted). So for an inherit struct, we end up computing the relevant nsRuleData*, then computing the nsStyle*, then throwing away the nsRuleData* and caching the nsStyle* on the style context. But the nsRuleData* is an invariant of the rulenode; if we have multiple style contexts (so style context sharing failed, say because the nodes have different depths in the DOM) that have the same rulenode, then they'll end up recomputing the nsRuleData*. There's an obvious cost here: the ruledata structs are not that small. And a related issue: they're not divided up by reset vs inherit. So to make this worthwhile we need to measure how often such a cache would be hit, and perhaps rejigger the ruledata/css structs to make sure we only cache the ones it's worth caching. Of course it might not be worthwhile even then. We need measurements here.
blocking2.0: --- → ?
Keywords: perf
OS: Mac OS X → All
Hardware: x86 → All
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.