Re: [whatwg] Script preloading

On Wed, 10 Jul 2013 16:39:42 +0100, Kyle Simpson <getify@gmail.com> wrote:

> I personally don't care about scripts being discoverable by pre-parsers.
[...]
> For instance, I've added like <link rel=prefetch> annotations for my  
> scripts into the head of my document, and then done my normal  
> script-based script loading as usual, and benchmarked if them being in  
> the markup somehow magically sped up the page. I saw no appreciable  
> increase in average page load speed in my testing.

The result you've seen is expected, as pre-parser and link prefetching are  
different mechanisms.

Prefetching of resources from rel="prefetch" is only done after page  
completely finishes loading, so it won't affect loading time of page that  
contains it (it's for future navigation, like "step1.html" containing  
prefetch for "step2.html").

There's rel="subresource" that's for immediate prefetching in the way  
you'd expect. You should see some improvement with it in cases where  
script loader makes it impossible for browser to start fetching scripts  
before the script loader is run:
http://www.chromium.org/spdy/link-headers-and-server-hint/link-rel-subresource

HTML pre-parser is basically equivalent of having rel="subresource" for  
all <script> elements.

-- 
regards, Kornel

Received on Wednesday, 10 July 2013 16:58:06 UTC