jquery-1.4.2.min.js is 71.8KB Same file pressed through this tool, with gzip enabled, bees 32.9 KB
Which is better? If latter, why doesn't jQuery provide a packed file too instead of just unpressed and min versions?
My Question: One is minified and gzip enabled, other is minified and packed and gzip enabled. Which should I use? If the one thats 32KB, I wonder why doesn't jquery provide a minified+packed version instead, any particular reason why?
Thanks
jquery-1.4.2.min.js is 71.8KB Same file pressed through this tool, with gzip enabled, bees 32.9 KB
Which is better? If latter, why doesn't jQuery provide a packed file too instead of just unpressed and min versions?
My Question: One is minified and gzip enabled, other is minified and packed and gzip enabled. Which should I use? If the one thats 32KB, I wonder why doesn't jquery provide a minified+packed version instead, any particular reason why?
Thanks
Share Improve this question edited May 22, 2010 at 12:34 eozzy asked May 22, 2010 at 12:29 eozzyeozzy 68.8k109 gold badges284 silver badges447 bronze badges 4- Possible duplicate of: stackoverflow./questions/807119/gzip-versus-minify – nc3b Commented May 22, 2010 at 12:31
- The current jQuery minified version, when served via gzip is only 24KB, so I don't understand your question, especially the edited version...your tool's making a bigger file than jQuery provides currently... – Nick Craver Commented May 22, 2010 at 12:39
- Right, but thats 24KB when served via gzip, but on my file browser it shows 78kb. The other file should be MUCH LESS in size when served via gzip because its already 32KB as my file browser shows, no? – eozzy Commented May 22, 2010 at 12:43
- Zip a file, zip it again, it gets larger the second time usually...not in this case, but the gzip gains on a pressed file are minimal if any at all...that 32KB won't get 60% smaller like the minified version will, take a look at Firebug to see this. – Nick Craver Commented May 22, 2010 at 12:45
3 Answers
Reset to default 10It's not an either question, use both, serve the minified file, over a gzip stream to the browser for the best/quickest delivery possibly.
Most web servers and almost every current browser support gzip. You're serving the minified file, with internal variables shortened etc...but then deliverying a zipped version of that to the client. By doing this you're delivering the minimum amount of javascript for the client to execute and delivering the smallest payload...so a quicker download for your user.
Also, remember to set cache headers so the client's not re-fetching the file...and there are other performance tips to go along with this you should read :)
Gzip encoding is handled on the fly by web servers. It isn't a feature of the file uploaded to the server, so it wouldn't make sense to provide the file in that format for download.
Gzip encoding and minification are not mutually exclusive.
Perhaps you mean the version packed with Dean Edward's packer? It indeed yields to smaller download but requires some processing on the client-side in order to depress it.