Post news RSS More SPEED!

Using Minify to speed up the sites Javascript and CSS.

Posted by on

We are now using Minify to combine, compress and cache our use of Javascript and CSS on the site. Regular visitors most likely won't notice a difference, because if you are using a good browser all of the current Javascript and CSS files should be cached anyhow. For those visiting with an empty cache, the site should be much faster to load. This is due to:

  • Less HTTP requests (multiple JS files combined into 1)
  • GZipped / minified download (so smaller download size)
  • Javascript's loading last once most of the page has rendered
  • Setting proper expire headers

This all happens automatically and on the fly. I tried loading Javascript in a "non-blocking" manner, as explained by the Yahoo experts but found keeping the order of code processing difficult. This meant Javascript would throw errors if the function it depended on was not yet available. I could have overcome this by creating a "ready" function, but this would mean quite a few code updates and given that future browsers plan on loading javascript in parallel, the benefit would be short lived.

feillyne Staff

So using multiple JS files slows down the performance? Good to know. :-)

Reply Good karma+1 vote
INtense! Author

Well more files means more HTTP request / response. This means more packets plus and your browser only loads two urls in parallel - so merging these files will provide a slight improvement.

Keep in mind though that most modern browsers cache really really well so the difference probably wont be noticable... this is mainly for new visitors to the site, we want it to load fast the first time.

Reply Good karma+3 votes

I have noticed a slight speed increase. Essentially a fast site has been made even faster. However, for some reason, the search bar at the top is sometimes misaligned.

Reply Good karma Bad karma+3 votes

Drugz are bad m'kay.

Reply Good karma Bad karma+1 vote

Well done INtense! Any increase % is a good one.

Reply Good karma Bad karma+2 votes

Does this affect images at all?

Reply Good karma Bad karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.