[wp-hackers] Re: Packing JavaScript

Otto otto at ottodestruct.com
Wed Sep 19 15:42:12 GMT 2007


On 9/18/07, Christian Höltje <docwhat+list.wp.hackers at gerf.org> wrote:
> Just curious, have you tried any of these things out yourself?
> Because what you're saying isn't true.

Yes, I have in fact, and what I'm saying is entirely true. It's just
that very few people here are getting it. Alex's own numbers prove me
correct:

285,305 bytes vs. 256,051 bytes. Packing his JS saved him all of 29k
or so. And that's *total*, mind you, this is not the savings on any
one page load.

Furthermore, the given suggestion of combining all of a page's JS into
one file transmission eliminates all benefits from browser side
caching of the JS files.

This entire conversation falls into the realm of premature
optimization. There's no substanial benefit for WordPress to pack the
JS files it uses. Consider that almost all of these files are
libraries acquired from elsewhere. If they offer a packed version
directly, fine, use that. However, packing them ourselves will a)
probably break things and b) require us to repack and retest them
every time we upgrade to a new version. It's not worth it.

If you want to pack your own JS, do it. If you want to make a plugin
to pack the JS files for users, do that. But this is outside the scope
of the core code.


More information about the wp-hackers mailing list