Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

min or gzip, which is better?

jquery-1.4.2.min.js is 71.8KB Same file compressed through this tool, with gzip enabled, becomes 32.9 KB

Which is better? If latter, why doesn't jQuery provide a packed file too instead of just uncompressed 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

like image 324
eozzy Avatar asked May 22 '10 12:05

eozzy


1 Answers

It'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 :)

like image 119
Nick Craver Avatar answered Sep 30 '22 15:09

Nick Craver