-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can spec stylesheets be faster? #220
Comments
Not quite. The non-draft version has a more nodes on it (478k vs 350k). The actual text for the draft is also about 70KB less (is this all stylesheet bits?). I did poke around quickly and I'm not sure what those extra 130k nodes are about . The draft seems to have things like support tables and bug annotations and whatnot... It might be worth figuring out what the difference there is For the main question, I'll try to do some profiling and see whether CSS/layout is still popping up. The node counts are heavily influenced by |
Ah, fair point. A lot of that these days is syntax highlighting, although that was only introduced in the last couple of weeks. Edit: https://html.spec.whatwg.org/commit-snapshots/21b8363138cb0ec3a0ce9a43850f52fd07ea3fb5/ is a version before syntax highlighting, for reference. Element counts are similar (155 108 review draft vs. 155 162 commit snapshot); didn't code up a node counter to check that. |
Yes, that commit snapshot pretty much matches the review draft in node count, thank you. I just tested, and the commit snapshot and the review draft both load in about 3-4 seconds for me in Firefox when coming more or less from cache. Same for Safari. Chrome is at about 13 seconds for the commit snapshot and 7s for the review draft. Uncached loads of the review draft are about 8s for Chrome, about 5s for Firefox and Safari. Uncached loads of the commit snapshot are about 13s for Chrome, about 7s for Firefox and Safari. |
Oh, and all those timings are pretty noisy, with an ~1-1.5s error bar. |
So looking at the sheets linked above,
Nothing else is jumping out at me as particularly bad right now. |
Attaching a Chrome trace from a local build on a fast-ish laptop. |
So after a quick profile in Gecko one thing that seems avoidable is the use of |
Removing the single rule with document.body.style.display="none";document.documentElement.offsetTop;d = new Date();document.body.style.display="";document.documentElement.offsetTop;new Date() - d by about 45% in Firefox on my machine, and in Chrome by about 10%. Raw data:
|
Ah, that rule is obsolete anyway due to syntax highlighting. |
Should also help with performance as per #220 (comment).
Should also help with performance as per #220 (comment).
* Makes "bad" examples fit the current code block style, instead of removing their background. * Marks ABNF code as such. This will require html-build tweaks to have an effect. * Adds syntax highlighting styles to the dev edition. Closes #3755. * Removes no-longer-necessary [hidden] rule, per whatwg/whatwg.org#220 (comment).
* Makes "bad" examples fit the current code block style, instead of removing their background. * Marks ABNF code as such. This will require html-build tweaks to have an effect. * Adds syntax highlighting styles to the dev edition. Closes #3755. * Removes no-longer-necessary [hidden] rule, per whatwg/whatwg.org#220 (comment).
* Makes "bad" examples fit the current code block style, instead of removing their background. * Marks ABNF code as such. This will require html-build tweaks to have an effect. * Adds syntax highlighting styles to the dev edition. Closes whatwg#3755. * Removes no-longer-necessary [hidden] rule, per whatwg/whatwg.org#220 (comment).
* Makes "bad" examples fit the current code block style, instead of removing their background. * Marks ABNF code as such. This will require html-build tweaks to have an effect. * Adds syntax highlighting styles to the dev edition. Closes whatwg#3755. * Removes no-longer-necessary [hidden] rule, per whatwg/whatwg.org#220 (comment).
Also preload resources? |
What advantage do you anticipate rel=preload having here over rel=stylesheet? |
I was under the impression that fetches would initiate earlier (even styles that aren't delayed due to a blocking script), especially using |
I don't think changing rel=stylesheet to rel=preload + rel=stylesheet (or rel=preconnect rel=preload rel=stylesheet) makes things any faster. If we moved to using Link: headers instead of link elements, that could be faster, but in that case we should just use Link:rel=stylesheet, avoiding preload. |
|
Anyone know to what extent this is still an issue? The reason I'm shipping the syntax highlighting markup I am today is solely to minimize the over-the-wire syntax weight; |
As everyone knows, the single-page HTML spec at https://html.spec.whatwg.org/ is fairly slow to load. Safari does pretty well IIRC, but others not so much.
However, the new review draft published at https://html.spec.whatwg.org/review-drafts/2018-07/ is quite fast. The only real difference between them is in the stylesheets.
I was talking to someone at TC39, and they mentioned that in the past the spec stylesheet for HTML used bad practices that caused O(n^2) behavior, and @bzbarsky and Hixie went back and forth on this for a bit. It was unclear whether Hixie applied all of the recommendations, or only some, or none. It's certainly the case that these stylesheets are quite old, and grew organically, so it's easy to believe they might have some bad practices in them.
So I wanted to open this issue to ask folks familiarly with CSS engine performance if there are things we can edit in the stylesheets to make things faster:
Thoughts appreciated!
The text was updated successfully, but these errors were encountered: