[wp-hackers] Packing JavaScript

Omry Yadan omry at yadan.net
Tue Sep 18 18:56:41 GMT 2007


1. How do you know unpacking the javascript is slower than downloading
the uncompressed file?

this depends on the client machine speed and on it's network speed.


2. obviously reducing the size of the code will make it download faster,
but does it really matter with today's conditions of fast connections
and smart browsers that cache everything?


3. I think the greatest benefit will not come from reducing the size of
the javascript files, but from including only the needed things in each
page. and NOT inlining huge chunks of javascript straight into the page.
(this prevents the browser from caching the javascript).

you can see example of such inlining on the widgets administration page.




Otto wrote:

> On 9/18/07, Charles <lists07 at wiltgen.net> wrote:
>   
>> Another plus is speed benefits for end users.
>>     
>
> Compressed javascript is slower for end users, because you have the
> extra overhead of unpacking the javascript.
>
>   
>> JavaScript compression complements generic text compression nicely.  I use
>> "SetOutputFilter DEFLATE", and that works very well.
>>     
>
> I doubt that the minimal difference between packed JS and unpacked JS,
> given than both are being compressed using zlib, is highly
> significant.
>
>   
>> Anyway, the combination of (1) JavaScript compression, (2) generic
>> server-side text compression and (3) file-combining is the norm, not the
>> exception, for sites that uses JavaScript for anything more serious than
>> roll-overs.
>>     
>
> 1 and 3 are useless in most (not all, mind you) cases. Whether it's
> the "norm" or not is debatable and largely opinion unless you can
> actually prove it with statistics. But whether they add a significant
> difference or not can actually be measured through testing. I submit
> that adding 1 and 3 to 2 will not produce a significant difference
> from just 2 alone.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>   



More information about the wp-hackers mailing list