Open Bug 90871 Opened 23 years ago Updated 2 years ago

Checking for firstline and firstletter is expensive

Categories

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

defect

Tracking

()

Future

People

(Reporter: bratell, Unassigned)

References

()

Details

(Keywords: perf, testcase)

It's too expensive to look for the firstline a firstletter styles. In the table 
stress case those "simple tests" are more than a 1% of the page load time in 
the table stress case. 

nsCSSFrameConstructor does the check in 
nsCSSFrameConstructor::HaveSpecialBlockStyle which is called during most 
construction (> 20000 calls for the table stress case). This is 0.78% of the 
total page load time.

The nsBlockFrame again checks for FirstLetter in 
nsBlockFrame::SetInitialChildList which is called from 
nsCSSFrameConstructor::SetInitialChildList. (The relevant function here is 
nsBlockFrame::GetFirstLetterStyle) That is 0.38% of the page load time.

So 1.16% of the page load time is spent calling 
nsPresContext::ProbePseudoStyleContextFor just checking for the two special 
styles.
nsCSSFrameConstructor::HaveSpecialBlockStyle() seems to be called 10K times, not 
20K times, but I agree: a small but not negligible amount of time is spent there.
Status: NEW → ASSIGNED
Summary: Checking for firstline and firstletter is expensive → [perf]Checking for firstline and firstletter is expensive
Target Milestone: --- → Future
Assigning pierre's remaining Style System-related bugs to myself.
Assignee: pierre → dbaron
Status: ASSIGNED → NEW
Priority: -- → P3
Keywords: testcase
David has mentioned in the past hanging the pseudo-style-contexts off the main
style context.  

In particular, that would mean that there would be a one-time cost to resolve
the pseudo-context; after that it would be either there or not.  And since there
is no way to trigger a reresolve of the pseudos without triggering a reresolve
of the parent, this should work....
Summary: [perf]Checking for firstline and firstletter is expensive → Checking for firstline and firstletter is expensive
Assignee: dbaron → nobody
QA Contact: ian → style-system
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.