Checking for firstline and firstletter is expensive

NEW
Unassigned

Status

()

Core
CSS Parsing and Computation
P3
normal
17 years ago
7 years ago

People

(Reporter: Daniel Bratell, Unassigned)

Tracking

({perf, testcase})

Trunk
Future
perf, testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

17 years ago
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.
(Reporter)

Updated

17 years ago

Comment 1

17 years ago
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

Updated

15 years ago
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....

Updated

14 years ago
Summary: [perf]Checking for firstline and firstletter is expensive → Checking for firstline and firstletter is expensive
Assignee: dbaron → nobody
QA Contact: ian → style-system
You need to log in before you can comment on or make changes to this bug.