W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2013

Re: [whatwg] Media aware JS loading

From: David Bruant <bruant.d@gmail.com>
Date: Tue, 21 May 2013 17:56:54 +0200
Message-ID: <519B9946.1030602@gmail.com>
To: Yoav Weiss <yoav@yoav.ws>
Cc: WHATWG <whatwg@whatwg.org>
Le 16/05/2013 15:22, Yoav Weiss a écrit :
> Arguably, the biggest problem in responsive Web design today is the fact
> that many resource loading mechanisms are media query agnostic, and
> download resources upfront regardless of whether they will be used or not.
>
> One of the biggest resources in question (right after images) is external
> JavaScript. JavaScript also has secondary performance effects, beside its
> download size, since parsing and running it are also time (& battery)
> consuming operations.
>
> Currently authors that want their scripts to load only under certain
> viewport sizes are forced to use JS based script loaders, which have the
> side-effect of preventing these scripts from being parsed out by the
> preloader.
How bad is the current situation with JS-based loaders? I would expect a 
JS-based loader and the couple of feature-detection tests to be rather 
small as well as heavily cachable, so not that awful for performance.

I'm not sure I understand your point about preloading scripts parsing. 
Do you want them to be preparsed (which costs in battery as you mention) 
or not preparsed (which will result in longer time when actually needing 
the script)?

> I believe that an HTML based solution would be a better fit, will be easier
> to use by authors, and will enable preloaders to do their job and preload
> these scripts.
How much time can be expected to be gained from such a feature given the 
state-of-the-art JS loaders?

Overall, what is the expected gain between a JS-based loader and a 
declarative media-aware loader? 1ms? 100ms?

Thanks,

David
Received on Tuesday, 21 May 2013 15:57:22 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 21 May 2013 15:57:22 UTC