The prototype library is getting heftier and heftier to load into every page (though, the cost of loading under a megabyte into a page is getting lower and lower at the same time). I''m refactoring a web application to, among many other things, leverage [wherever possible] ajax to inform more structured (and much more compact) interfaces and make business logic more accesible inline. The issue I''m having is in cutting up the prototype library into constituent files and finding a good strategy for doing it. I already have a very good implementation of a dependency loader that loads script into the browser just-in-time (based on stated dependencies in the currently loading source file), and I want to push prototype into smaller files that leverage this to load up a custom environment of javascript based on the needs of the interface. Does anyone have any good suggestions/recommendations for pulling apart prototype.js beyond a base/ajax strategy? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Depending upon your server side code, take a look at ... http://rakaz.nl/projects/combine/combine.phps http://rakaz.nl/item/make_your_pages_load_faster_by_combining_and_compressing_javascript_and_css_files Using caching makes a SIGNIFICANT difference to bandwidth usage. They load the file once. I use a modified version of this and it has cut down the hits considerably. On 03/08/07, patrick.ninja <p.collin.evans-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > The prototype library is getting heftier and heftier to load into > every page (though, the cost of loading under a megabyte into a page > is getting lower and lower at the same time). I''m refactoring a web > application to, among many other things, leverage [wherever possible] > ajax to inform more structured (and much more compact) interfaces and > make business logic more accesible inline. > > The issue I''m having is in cutting up the prototype library into > constituent files and finding a good strategy for doing it. I already > have a very good implementation of a dependency loader that loads > script into the browser just-in-time (based on stated dependencies in > the currently loading source file), and I want to push prototype into > smaller files that leverage this to load up a custom environment of > javascript based on the needs of the interface. > > Does anyone have any good suggestions/recommendations for pulling > apart prototype.js beyond a base/ajax strategy? > > > > >-- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" --~--~---------~--~----~------------~-------~--~----~ 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 03 Aug 2007, at 16:22, Richard Quadling wrote:> Depending upon your server side code, take a look at ... > > http://rakaz.nl/projects/combine/combine.phps > > http://rakaz.nl/item/ > make_your_pages_load_faster_by_combining_and_compressing_javascript_an > d_css_files > > Using caching makes a SIGNIFICANT difference to bandwidth usage. They > load the file once. > > I use a modified version of this and it has cut down the hits > considerably.I''ve dealt with this issue myself and I feel I really need to put this claim in context. You get the most speed benefit from compressing the files before sending them to the user (using mod_deflate from Apache, it''s so easy) and by letting Apache serve static files (i.e. cache as much of your dynamically generated code as possible). Period. Letting Apache cache the compressed version will only yield a very small gain (but will bring down the load on your server). Combining all the files into one and then compressing it before sending it to the user didn''t give me the results I was expecting. It does shave off a few bytes compared to the compressed individual files, but not enough to make it seem like the ultimate solution, as this article claims. Also note that without caching the combined file, using an interpreter (like php or ruby) to generate one big combined file can actually slow down your application and put a bigger load on your server. One must also keep in mind that after the initial download of the files, the user''s browser will just use the locally cached version over and over again, your server won''t have to serve the files on every request, whether you''re serving one file or more. All I''m trying to say is: don''t get tempted by so-called solutions to problems that are seriously exagerated and if you do run into server load issues, you need to find out what''s causing it and solve that problem (and I''m pretty sure these few javascript files won''t be the bottleneck). Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---