[whatwg] Proposal for separating script downloads and execution

On Tue, Feb 8, 2011 at 10:44 AM, Henri Sivonen <hsivonen at iki.fi> wrote:

> I thought the case being addressed here is fetching scripts early but not
> compiling or evaluating them until the app knows the functionality provided
> the script is going to be needed. The degradation story depends on the side
> effects of evaluating the script.
>
> Aside: It seems like what the mobile Gmail developers are trying to do and
> what the browser developers are thinking *they* can outsmart the other by
> doing tricks. On one hand, browser developers want to compile scripts as
> early as possible before the script is ready to be evaluated. On the other
> hand, the mobile Gmail developers seem to believe that compiling scripts is
> too expensive


I am not on the GMail team, but we did see similar issues on the GWT team --
simply parsing the downloaded script takes a lot of time and interferes with
user interaction with the UI, so as awkward as it seems, downloading the
script in a comment in the background, and then evaluating it when needed
does provide a better user experience on mobile devices.

See
http://googlecode.blogspot.com/2009/09/gmail-for-mobile-html5-series-reducing.html
for
the official blog post about this technique.

So, I think you should consider having download / parse / execute be
separate if you are going to go to the trouble to do anything.

-- 
John A. Tamplin
Software Engineer (GWT), Google

Received on Tuesday, 8 February 2011 08:06:52 UTC