Closed Bug 74598 Opened 24 years ago Closed 23 years ago

Avoid resolving style on text nodes

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla0.9.8

People

(Reporter: attinasi, Assigned: attinasi)

Details

(Keywords: memory-footprint, perf)

Text nodes cannot have any style directly applied to them (see bug 56117) so they should be able to get their style data from their parent rather than have a style context of their own. We could avoid resolving style on the text nodes altogether, which could be a performance benefit.
An optimization that is already in the style system is to share the style context across siblings with the same rules. This mechanism allows most text nodes to share the same style context rather than having their own, however the cost of evaluating the sharing is still incurred (note: this is not the style context data sharing that I put in, but rather a more efficient style context sharing that Peter Linss put in. It simply checks if there are sibling elements with exactly the same rules using a hash).
Status: NEW → ASSIGNED
Text nodes can't share the same style context as their parent; they have to use initial values for things like 'background' and 'border' (i.e., they should only inherit the inheritable properties). Otherwise, imagine the result of: div { border: solid; } <div> hello <-- --> world </div>
Marc, FWIW, I profiled the Reply case that was discussed in the meeting, and the style system is only responsible for 1.8% or so, a preposterously low number. I think we should look at this bug more as a footprint win than necessarily a speed win, given the already-existing optimization you just mentioned. I still think it's worth doing though.
Ian, you are, of course, absolutely correct. Maybe the current scheme of using normal style resolution for the first sibling, and the the brute-force sharing for all subsequent sharing is the best we can do to minimize the _work_ involved in getting valid style contexts for the text nodes. David, thanks for the data. Keep in mind that Pierre's new style sharing scheme may help out on the footprint front.
Keywords: footprint, perf
Target Milestone: --- → mozilla0.9.8
Thsi was fixed by dbaron's fix to bug 56117 - marking FIXED
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.