Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2007-11-25
10
Medium Priority
?
2,469 Views
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."

http://www.julienlecomte.net/blog/2007/08/13/

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.
0
Comment
Question by:thyros
[X]
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
10 Comments
 
LVL 63

Expert Comment

by:Zvonko
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.

0
 
LVL 41

Expert Comment

by:HonorGod
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?
0
 

Author Comment

by:thyros
ID: 20372760
Hi,

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?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 63

Expert Comment

by:Zvonko
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.

0
 

Author Comment

by:thyros
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.
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 2000 total points
ID: 20812185
0
 

Author Comment

by:thyros
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.

Thanks.
0
 

Author Closing Comment

by:thyros
ID: 31410867
Thanks again.
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 20973431
Thanks for coming back (and for pointz :)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

636 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