Don't try to optimize the wrong thing.

Just serve the file gzipped and with proper caching and expiration  
headers. gzip usually yields a 1:4 or 1:5 compression ratio on  
JavaScript, and the headers will make sure the file is only downloads  
once while the user stays on the site (or returns to it).

_Breaking it up_ in more than one part will _actually slow everything  
down_, as the browser will make multiple connections to the web  
server,  and they only occur after each other.

It depends on your server-side software on how to enable this, but  
here's a starting point:
http://www.thinkvitamin.com/features/webapps/serving-javascript-fast

Best,
Thomas

Am 13.08.2007 um 16:39 schrieb PrototypeWannabe:

>
> Hello,
>
> While this is my first post on this forum, I've been looking at
> Prototype seriously for the past 3-4 months. So far, it seems to have
> everything I need.
>
> I've been looking at developing a web framework and my Javascript
> needs are more than satisfied by Prototype. But that's the problem. I
> do not need all of Prototype.js. So I was wondering if it is possible
> and viable to try and break up the JS file into multiple parts. The
> reason I ask is because the js file is more than 3000 lines long (I'm
> looking at 1.5+). I have to believe the browser spends some time
> fetching this file from the server. Given that I would only like to
> deliver and use those parts of Prototype that I have use for, I'm
> thinking my pages will load faster if I break up the file.
>
> Needless to say I will need to spend some time looking at the js file
> in detail to "see" how things work before I can chop the file into
> chunks. I was wondering if anyone has looked into this. I was even
> thinking of deleting some functions that I don't need in order to
> reduce the size.
>
> Which brings me to my final questions. I will surely end up delivering
> a JS file to my browser users which will not be the original
> Prototype.js. In that case, should I call it Prototype.js? I would
> think not. Besides I'm not sure if this is in violation of the license
> - if I change the contents, am I required to change the filename?
> Also, regardless, I want to give credit where credit is due as long as
> it does not confuse anyone looking at how things are implemented. How
> do I manage to do so? Any hints, suggestions, usage etiquettes from
> Prototype users would be very helpful.
>
> Thanks in advance for your time and help.
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to