jQuery 1.5: Better, Faster… Bigger

Thursday, 17 February 2011

Back when jQuery was heading towards its 1.0 release, one of the things that really impressed me was its small size. Only about 15KB of uncompressed code was enough to turn JavaScript (and particularly DOM manipulation) from a chore into a pleasure. But with each new release, new features and speed optimisations have inevitably bloated the library. Every time a new release came out, it seemed to me that the svelte jQuery I knew and loved was receding further into the past. Now that jQuery 1.5 is out, I thought I would see how jQuery has grown in size as well as stature with each release.

Graph of jQuery download size over time

The graph just about says it all. It shows the size of a zipped jQuery download for each release (I omitted a few of the minor releases due to laziness). I have overlaid a linear trendline, which fits pretty well and shows that jQuery’s size has grown about 4.6KB every year. jQuery 1.5 is three times the download size of jQuery 1.0. The uncompressed JavaScript is closer to five times as big, as the table shows.

Date Version Zip Size Pack Minify Pack.Zip Min.Zip
4/02/2006 0.x 6 19 13 6
26/08/2006 1.0 9 45 17 9
14/01/2007 1.1 11 56 21 11
10/09/2007 1.2 15 78 27 45 14 15
16/09/2007 1.2.1 15 79 27 46 14 15
14/01/2008 1.2.2 16 94 29 52 15 16
7/02/2008 1.2.3 16 95 30 53 15 16
19/05/2008 1.2.4 16 96 30 54 15 16
20/05/2008 1.2.5 17 98 31 55 16 17
24/05/2008 1.2.6 17 98 31 55 16 17
14/01/2009 1.3 19 115 54 19
21/01/2009 1.3.1 19 115 54 19
20/02/2009 1.3.2 20 118 56 20
14/01/2010 1.4 24 155 69 24
25/01/2010 1.4.1 24 157 70 24
19/02/2010 1.4.2 24 161 71 24
16/10/2010 1.4.3 27 177 76 27
11/11/2010 1.4.4 27 179 77 27
31/01/2011 1.5 29 208 83 29

The numbers in the first row may be slightly speculative, since I had to reconstruct some of those files — I didn’t just have them lying around.

In the old days, the jQuery website used to talk about the size of the library in uncompressed form or in packed form. At some point they changed this and started quoting the minified and gzipped size. This confused me at first — I thought that jQuery had actually gotten smaller — but then I realised it was just a bit of spin.

The jQuery team used to use Packer (or some variant of it) to squash the JavaScript before gzipping, but from version 1.2 they started using Minify too and from 1.3 they switched to Minify exclusively. jQuery 1.5 is minified using what looks like a custom script driven by Node.js. It’s interesting to see that minify performs quite poorly compared to Packer, but the resulting file gzips much better. The end result is still pretty lean — 29KB for the best JavaScript library around — but it’s a long way from the 6KB download I first played with five years ago.

Tags: , ,

5 comments

You can leave a comment, or trackback from your own site.

  1. That why it’s also becoming increasingly popular to let Google host jQuery for you. 🙂 http://code.google.com/apis/libraries/devguide.html#jquery

  2. Great chart. Any chance you can update it for 1.6?

  3. jQuery 1.6 is a 31kB download, or 228kB source. Hmm, a little bit of an upward slope as the download size has gone up by 2k in 3 months.

  4. Is there a way that we can mignify it even more or to use the code that we only need?

  5. @Andrea, you might be able to use the Closure Compiler to achieve this.

Leave a comment