Open Bug 510121 Opened 14 years ago Updated 2 months ago

Use cached stylesheet while waiting for if-modified-since response


(Core :: CSS Parsing and Computation, enhancement)





(Reporter: jruderman, Unassigned)



(Keywords: perf)

It might be good to use cached stylesheets while waiting for if-modified-since responses.

The theory is that since stylesheets block the display of the page and are infrequently modified, optimistically using an old version will cause earlier "useful display of the page" much of the time.

If we get a 304 response, there's no more work to do.  If we get a new response, we'd have to restyle.  (It might make sense to compare the response text for 200s, since comparing the stylesheet text might be cheaper than reparsing and restyling.)

We'd probably have to ignore -moz-binding (or not do this for stylesheets that use -moz-binding).  We'd also have to delay script requests for computed styles, which might be fun.

This idea might interact with the idea in bug 219276 in interesting ways.


* For stylesheets, how common are (1) use of cache without sending an if-modified-since request, (2) "304 not modified", (3) 200 without modifications, and (4) 200 with modifications?

* What's the computation cost of restyling a document, in the case where the stylesheet turns out to be modified?
It's not just restyling.  Stylesheets, unlike images, expose an OM.  So what should happen if someone has grabbed references to the "wrong" sheet's rules?

Unless we block script on getting the 304, of course.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.