aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Javscript performance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Javscript performance" Watch "Javscript performance" New topic
Author

Javscript performance

Luke Murphy
Ranch Hand

Joined: May 12, 2010
Posts: 300
I have heard that you can increase javascript download time by zipping it. Is there any do's, don't's, best practises here?
And are they any neat tricks that I can cache things in the client?
Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60997
    
  65

gzipping any response can minimize the size of the transfer and hence help performance. Just remember that the response then needs to be unzipped which may actually hinder performance for small loads.

Caching is a good way to minimize re-downloading unnecessary resources. Serving images, CSS, and script files as static resources causes the browser to cache them according to the browser's settings.

Using CDN versions of popular JavaScript libraries can help make sure that those don't get needlessly downloaded.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Luke Murphy
Ranch Hand

Joined: May 12, 2010
Posts: 300
Bear Bibeault wrote:gzipping any response can minimize the size of the transfer and hence help performance. Just remember that the response then needs to be unzipped which may actually hinder performance for small loads.

Caching is a good way to minimize re-downloading unnecessary resources. Serving images, CSS, and script files as static resources causes the browser to cache them according to the browser's settings.

Using CDN versions of popular JavaScript libraries can help make sure that those don't get needlessly downloaded.

Oh CDN? So you just put the JS libraries on very fast servers and then remotely reference them inside yor pages? Is that what you mean?

How do I set the browser to cache Javascript parts?

Thanks.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Here's a nice set of 14 rules for increasing web site performance, in general.

http://stevesouders.com/hpws/rules.php


GenRocket - Experts at Building Test Data
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Luke Murphy wrote:
Bear Bibeault wrote:gzipping any response can minimize the size of the transfer and hence help performance. Just remember that the response then needs to be unzipped which may actually hinder performance for small loads.

Caching is a good way to minimize re-downloading unnecessary resources. Serving images, CSS, and script files as static resources causes the browser to cache them according to the browser's settings.

Using CDN versions of popular JavaScript libraries can help make sure that those don't get needlessly downloaded.

Oh CDN? So you just put the JS libraries on very fast servers and then remotely reference them inside yor pages? Is that what you mean?

How do I set the browser to cache Javascript parts?

Thanks.


You don't put JS libraries on a CDN (unless you want to manage your own CDN). You use existing CDN's and link to their resources. For example:

http://code.jquery.com/jquery-1.6.2.min.js

The browser should cache what and when it needs to automatically. You cannot control the user and the possibility of them disabling caching and/or deleting the cache.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Javscript performance