Using JQuery in Production Environment on Windows.  Best to Gzip, Pack, Minify or leave uncompressed?

Posted on 2007-11-25
Medium Priority
Last Modified: 2013-11-19
I am hosting a website on a Windows server, and I would like to use the JQuery library for some general functionality and effects.  However, the uncompressed version of the file is approx 77kb, which seems a bit much, or is that acceptable?

There are a number of versions available from the site http://jquery.com/

Minified - http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.2.1.min.js  45.3 KB

Packed - http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.2.1.pack.js 26.5KB

Uncompressed - http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.2.1.js 78.6 KB

However, from the homepage itself it mentions a version being minified and gzipped as being 14KB, but there's no download link there, only to the minified version which has a 45Kb filesize.

I don't have any experience or knowledge about the differences between gzip, packed, minified etc.  What is the best method for including the JQuery library into the site?  I was under the impression that gzip was for Unix servers only, is that correct?  I have a separate Unix box which I could host the file on, but how would I reference it in the header, and would there be any problems with ssl and differing domain names.  i.e. assuming the main site is called www.windows.com and the file is hosted at https://unix.windows.com/jquery.js  ?

My initial thought is to go with the packed version at 26kb, but someone advised against it on one of the blogs related to the jquery site.  Here is what they said:

"using Packer™s redundancy reduction algorithm adds a delay at the time the script gets executed (because the script needs to be unpacked and then evaled) On my laptop, this delay is about 200 msec. The conclusion is clear: for optimal performance, gzip your JavaScript code, and stay away from advanced JavaScript compression schemes that look attractive on paper, but end up degrading the performance of your site."

And another comment:

"GZip is absolutely the correct way to compress javascript.

No eval-based compression scheme should be used because it simply takes too long to decompress the javascript file in the browser.

Don™t believe me? Consider the savings. If you save 40 kB by compression from 60 kB to 20 kB, it only takes 40 ms longer to download the full file the first time using a 8M ADSL connection.

Afterwards, you pay for the compression every time when the page is being reloaded. If it only takes 10 ms to decompress (and my measurements indicate that for my hardware it™s more like 20 ms), then after 8 page refreshes the advantage is gone.

So say yes to minimification schemes that make it possible to cache and reuse the javascript file without a decompression step.

Size isn™t everything."


Based on such information, what would be your advise, go ahead with the packed version at 26kb and disregard the execution time each time a page loads, or simply use the uncompressed version at over 77kb?  The site I am working on is targeted at the UK audience, and from what I understand, most people are on atleast 2mb broadband here.
Question by:thyros
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
LVL 63

Expert Comment

ID: 20347341
Your last statement say it all: Do not care :)
Seriously, the script are loaded in browser only ONCE (normally), that means your refresh summery does not count.

LVL 41

Expert Comment

ID: 20347692
What kind of user do you expect?  Are they on an intranet?  If so, one would expect faster retrieval of the information from the web server.  Can you do some testing of "expected" user environments?  This would give you a better understanding, and appreciation for the actual delay being experienced.  Is it noticeable, or not?

Author Comment

ID: 20372760

The js library is being included on a pubic website, so users from the general internet would be accessing it; thus it would cover all scopes of environment's and connections, but overall from the limited research I have done, most users in the UK are connecting to the net via broadband, and on average that is about 2mbps, and one study says 4mbps.  Being conservative and assuming 2mbps is more widespread, it should not add too much extra weight in downloading the full uncompressed file.  I would have gone with the packer, but the comments from that jquery blog put me off, as it said there is a mini delay each time the script is 'unpacked' in the browser.

The question then, is that does the browser unpack the script on each page refresh? or is it the case that once unpacked, its done and doesn't need to be repeated again?
Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

LVL 63

Expert Comment

ID: 20378061
The normal standard way is that browser is set to cache the images and scripts of a page. Once cached the files are not fetched. For unzip I did never think about it but caching makes sense for me only to cache the unzipped file version.
The user can of course set his browser NOT to cache files and fetch every file again and again at every refresh.


Author Comment

ID: 20810904
I would like to have this topic resolved, but I would like a bit more specific answer.  To rephrase the question,  the jquery library is coming in several formats.  Which is the best to use in windows production environment, the gzip, minified, or pack version? or just use uncompressed?

If someone can answer this:  if a packed/compressed script is used, does the browser have to unpack/uncompress the script each page load and hit, or is it the case that once downloaded and unpacked, it will not need to unpack it each page visit?  if you can provide some proof or links to verify this information, I would accept that as satisfactory answer.
LVL 63

Accepted Solution

Zvonko earned 2000 total points
ID: 20812185

Author Comment

ID: 20971967
Sorry for the delay in getting back to this topic.  Zvonko should get the points for his latest post.  I will select it as the answer now.


Author Closing Comment

ID: 31410867
Thanks again.
LVL 63

Expert Comment

ID: 20973431
Thanks for coming back (and for pointz :)

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question