Bug 81715

Summary: Preload scanner unhelpful on yahoo.com
Product: WebKit Reporter: James Simonsen <simonjam>
Component: Page LoadingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: ap, gavinp, koivisto, nduca, pmeenan, skyul, tonyg
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   

Description James Simonsen 2012-03-20 16:17:08 PDT
Someone reported that Chrome loads yahoo.com 100+ ms slower than other browsers. Analyzing the trace shows that the subresources loaded later. One cause was that the preload scanner failed to preload the resources. This happened for two reasons:

1. The preload scanner will only preload CSS and JS before first paint. It could've loaded 30 other resources 30 - 80 ms earlier without that restriction. IIRC, the restriction was added to prevent responses from interfering with first paint, which regressed some benchmark.

2. The entire document was already available to the HTML parser. The parser ended up discovering all of the resources before first paint. So, this check didn't actually serve its intended purpose. It just slowed down the load.

Requesting all 30 resources took 750 us, so it's not a significant delay. That suggests this logic is intended to prevent us from getting responses too quickly. I propose we implement the throttling on the response side, instead of the request side. Getting the requests out on the wire (or at least to the network stack) sooner is better. Network is often the weakest link.
Comment 1 Tony Gentilcore 2012-03-21 06:12:15 PDT
> 1. The preload scanner will only preload CSS and JS before first paint. It could've loaded 30 other resources 30 - 80 ms earlier without that restriction. IIRC, the restriction was added to prevent responses from interfering with first paint, which regressed some benchmark.

At one point the PreloadScanner would not load any resources in the body while parsing the head. I investigated that in bug 45072 and relaxed that restriction so that the PreloadScanner would always load scripts and stylesheets, but left the restriction in place for images. Details in the bug.

We should definitely revisit this as I was only testing with a limited subset of sets and it is certainly possible I missed something.

> Requesting all 30 resources took 750 us, so it's not a significant delay. That suggests this logic is intended to prevent us from getting responses too quickly. I propose we implement the throttling on the response side, instead of the request side. Getting the requests out on the wire (or at least to the network stack) sooner is better. Network is often the weakest link.

I like that idea a lot.
Comment 2 Antti Koivisto 2012-03-21 14:09:44 PDT
Yeah, it is a good idea to revisit these assumptions.