Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Javscript performance

 
Luke Murphy
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Luke Murphy
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a nice set of 14 rules for increasing web site performance, in general.

http://stevesouders.com/hpws/rules.php
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic