Jean-Philippe Encausse
2006-Nov-24 09:28 UTC
Merge, Compact Ofuscate or Compress Javascript Lib ?
Hi !, A little question about JS Lib manipulation... - I found that DOJO toolkit gives a DOJO Compressor jar file to compress JavaScript http://dojotoolkit.org/docs/compressor_system.html - On the other hand there''s no docs in Prototype or Scriptaculous and prototype files are merged. Why ??? 1. Compacting file will reduce bandwidth but is it useful with a server that gzip .js ? 2. Merging files will reduce browser request but they are cached by browser ? So ? Why doing this ? If a JS Lib contains lots of comments and spaces, would that influence the JS Compiler/Interpreter ? Does any body benchmark a difference between loading and using a big JS Files with lots of comments and the same striped ? Best Regards, Jp -- Jean-Philippe Encausse - R&D Jalios SA Jp [at] encausse.net - http://www.encausse.com - http://www.jalias.com GTalk: jp.encausse [at] gmail.com - SMS: sms [at] jp.encausse.net Mob: +33 6 82 12 56 99 Jalios: +33 1 39 23 92 83 Tel: +33 1 39 18 90 15 Do it Once, Use it Twice ~ Do it Twice, Make It Once --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Nov 24, 10:28 am, "Jean-Philippe Encausse" <J...-vcK5r0oTKUrk1uMJSBkQmQ@public.gmane.org> wrote:> 1. Compacting file will reduce bandwidth but is it useful with a > server that gzip .js ?You can compact (pack) your .js, you can gzip it, but why not both? If you do both, the size goes down drastically. And remember, lots of people prefer just to pack the files and not gzip them because IE had (has??) problems decompressing received files.> 2. Merging files will reduce browser request but they are cached by browser ?Nevertheless, merging reduces the server load. Caching is great but it''s not forever, and you must think of first-time visitors, too.> If a JS Lib contains lots of comments and spaces, would that influence > the JS Compiler/Interpreter ?Of course not. Comments have no effect on the code and whitespace is rarely significant in JavaScript. Even if you don''t put semicolons (;) on the end of your lines (which you don''t have to), when using Dojo ShrinkSafe online version you can safely tick the checkbox to remove whitespace - its parser that packs the code is not dumb. My last site has 10 .css files that take up more than 30KB. Packed and gzipped they are contained in a single file and weight just over 6KB. It has 106KB worth of JavaScript across 6 files - packing and gzipping brings that down below 40KB in a single file. I don''t need to benchmark this to know it was a bloody smart thing to do. -- Mislav --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Jean-Philippe Encausse
2006-Nov-24 15:55 UTC
Re: Merge, Compact Ofuscate or Compress Javascript Lib ?
Hi,> My last site has 10 .css files that take up more than 30KB. Packed and > gzipped they are contained in a single file and weight just over 6KB. > It has 106KB worth of JavaScript across 6 files - packing and gzipping > brings that down below 40KB in a single file. I don''t need to benchmark > this to know it was a bloody smart thing to do.Yes, it''s clean, smart, reduce server load on the 1st request, but that''s all... My question in fact is: This doesn''t improve browsing, code running in any way ? (Well, Only for the first request but not hundreds later ...)> and you must think of first-time visitors, too.Yes it depends of the web site. Less important for an Intranet people use every day ? Regards, Jp -- Jean-Philippe Encausse - R&D Jalios SA Jp [at] encausse.net - http://www.encausse.com - http://www.jalias.com GTalk: jp.encausse [at] gmail.com - SMS: sms [at] jp.encausse.net Mob: +33 6 82 12 56 99 Jalios: +33 1 39 23 92 83 Tel: +33 1 39 18 90 15 Do it Once, Use it Twice ~ Do it Twice, Make It Once --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
* Jean-Philippe Encausse wrote (24/11/06 15:55):> Hi, > >> My last site has 10 .css files that take up more than 30KB. Packed and >> gzipped they are contained in a single file and weight just over 6KB. >> It has 106KB worth of JavaScript across 6 files - packing and gzipping >> brings that down below 40KB in a single file. I don''t need to benchmark >> this to know it was a bloody smart thing to do. > > > Yes, it''s clean, smart, reduce server load on the 1st request, but that''s all... > My question in fact is: This doesn''t improve browsing, code running in > any way ? > (Well, Only for the first request but not hundreds later ...)Merging all your js files into one helps (I think) when you have users with high latency. A browser makes a request to the server for a js file saying "if modified since <cached version''s timestamp>". The server replies with a 304 "not modified". The HTML spec says that a browser should only make 2 requests at a time to one server, and IE is compliant in this respect. So in a high-latency environment you ought to see bigger delays if you have many js files compared to just one *even* if the js files are cached (so the size of the file isn''t significant). The delays should be worse in IE than many other browsers, because it complies with the HTML standard while they don''t. At least, that''s my understanding. I''d like to know if it''s wrong. In a low-latency, high-bandwidth environment I doubt you''d notice a difference most of the time. The extra speed you get from gzipping might even be lost due to the extra processing overhead at both the client and server. Sorry - no benchmark info available, but I make sure that all js is compressed (via a js code compressor), put into one file, and gzipped in transit. Chris --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
There is a good read on the Y! User Interface blog: http://yuiblog.com/blog/2006/11/28/performance-research-part-1/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Thomas Fuchs
2006-Nov-29 13:57 UTC
Re: Merge, Compact Ofuscate or Compress Javascript Lib ?
Am 24.11.2006 um 12:42 schrieb Mislav:> > My last site has 10 .css files that take up more than 30KB. Packed and > gzipped they are contained in a single file and weight just over 6KB. > It has 106KB worth of JavaScript across 6 files - packing and gzipping > brings that down below 40KB in a single file. I don''t need to > benchmark > this to know it was a bloody smart thing to do.What about the overhead for ungzipping client-side? Note that this will probably only slower if you have a _very_ fast connection, but who knows...? :) -- Thomas Fuchs wollzelle http://www.wollzelle.com questentier on AIM madrobby on irc.freenode.net http://www.fluxiom.com :: online digital asset management http://script.aculo.us :: Web 2.0 JavaScript http://mir.aculo.us :: Where no web developer has gone before --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---