[whatwg] Script preloading
Kornel Lesiński
kornel at geekhood.net
Wed Jul 10 09:56:49 PDT 2013
On Wed, 10 Jul 2013 16:39:42 +0100, Kyle Simpson <getify at 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
More information about the whatwg
mailing list