Showing posts with label css. Show all posts
Showing posts with label css. Show all posts

Wednesday, March 9, 2011

Performance Optimization - Part 2

Hi,

In my pervious post I had explained few reasons of slow server response time along with its solution. In this I will discuss how even after the response is received from the server, the page tend to load in the browser slowly. Following can be the reasons for that:


1. Heavy CSS and Javascript files
2. Too many images
3. Extensive DHTML processing loops


1. Heavy CSS and Javascript files
Sometimes using too many javascript libraries increases the size of Javascripts resulting in slow page. The best solution for this is choosing the Javascript framework smartly. If you are using common layout for multiple pages, then put only those JS files in the layout which will be common to all pages e.g. jquery.js. If you are using a package which is used only in few pages and not all, then do not put those in the layout, instead put them indivisually in each page e.g. the google map js.

Second and probably the best way to optimize JS and CSS usage is by JS/CSS compression. If you use gzip compression for CSS and Javascript, on an average it reduces the size by 80%, which really boosts up the speed. Click here to view my article on JS/CSS compression. It is really easy and extremely effective.

Install firebug in your Mozilla browser to analyze the above.

2. Too many images