[whatwg] Proposal for separating script downloads and execution

On 5/26/11 1:10 AM, Ian Hickson wrote:
> It's presumably a whole heck of a lot more complex than brack matching:
>
>     alert('fail');
>     function test () {
>       // ...megabytes of perfectly fine code...
>       a b;
>     }
>
> ...had better not alert anything.

And in V8 does not, indeed.

> What we really need though is perf data, e.g. comparing how browsers
> handle code such as:
>
>     <script>
>      var times = [];
>      times.push(new Date());
>     </script>
>     <script>
>      times.push(new Date());
>      function test() {
>        // ...megabytes of complicated code...
>      };
>      times.push(new Date());
>      test();
>      times.push(new Date());
>     </script>
>
> What are the deltas between all the times in various browsers?

Cute idea.  You have to disentangle effects like the second script's 
text not being fully downloaded yet when the first script runs, so 
loading from file:// or at least from cache is good.  You could probably 
modify the test to use a script-inserted script instead, but I suspect 
that would not change things much.

In any case, I put up that testcase using 4 copies of the non-minified 
version of JQuery 1.6.1 as the "complicated code" at 
<http://web.mit.edu/bzbarsky/www/testcases/javascript/parse-vs-execute-performance-jquery-1.6.1.html>. 
  The first load will have that downloading issue, but subsequent loads 
should be ok.  Or save to a local file to avoid the network effects.

I see numbers in ms like so for the deltas (without error bars, but all 
are plus or minus 4ms or so based on eyeballing):

Firefox Nightly: 60, 0, 17
Chrome 12 dev: 43, 0, 160 or 19 (the last number is bimodal; this
                                  happens from file:// too, so not
                                  network-related).
WebKit nightly: 30, 0, 30
Opera 11: 22, 0, 10
IE9 (on different hardware): 32, 0, 67

> I would expect the deltas to be a high number, 0, and a high number
> respectively.

Yep.

I would be happy to redo the test with different "complicated code" if 
people think that another test corpus would be better.  Just point me to 
the code you want tested.

-Boris

Received on Wednesday, 25 May 2011 22:48:12 UTC