New issue
Advanced search Search tips

Issue 902211 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

html.css is parsed in every new process

Project Member Reported by fergal@chromium.org, Nov 6

Issue description

Looking at traces of pages loads, I see ~20ms (on my workstation) of time on main thread spent parsing a style sheet before anything is loaded. It seems this is html.css which doesn't vary from page to page so presumably could be parsed once and the parsed structure copied, saving some (as yet unknown) amount of time on each load.

There is a second parse of a 3.5k sheet that occurs too, not sure yet which sheet this is.

There are also some RuleSet::addRulesFromSheet that follow. It's possible we could start by copying the initial RuleSet with the first sheet parsed as step one.
 
html.css is parsed once per rendering process. If I do chrome://tracing for my content_shell loading two documents without stylesheets in a row, I do not see stylesheet parsing in my trace at all. Probably because I started tracing after the first access to html.css.

Owner: fergal@chromium.org
Status: Assigned (was: Untriaged)
There's always a possibility to have UA stylesheets in a format that's faster to instantiate. I thought we had an open issue for that somewhere, but I'm not able to find it now.

Fergal, are you seeing new instances of rendering processes loading the html.css, or do you have a repro that shows re-parsing within the same process?

I'll confirm but I thought I saw it all the time. That could have bee because I was clearing cache for repro purposes but I imagine site isolation would also impact this.

Summary: html.css is parsed in every new process (was: investigate parsing of html.css on every page load)
Looking at traces, it seems that each new process does only parse it once however loading (presumably with site isolation) www.cnn.com starts 7 processes.

I can also confirm that navigating from cnn to facebook and back again causes a reparse.

It's hard to know exactly what impact is but it definitely seems like fixing this could be worth some effort. Unclear how much.

I assume that this is going to suffer from the existing AtomicString cannot be used cross-thread which is going to make it hard to simply copy a data structure from a central copy.
Cc: emilio@chromium.org
> I assume that this is going to suffer from the existing AtomicString cannot be used cross-thread which is going to make it hard to simply copy a data structure from a central copy.

This is not only cross-thread, it's cross-process. I think creating some pre-parsed format at compile time that is a lot faster to load could be an option.

Owner: ----
Status: Untriaged (was: Assigned)
Status: Available (was: Untriaged)

Sign in to add a comment