Feb 12, 2006 There are a lot of articles explaining the basics in performance optimization in ASP.NET. Here
is one and here
is another. It is important to know the basics and use them where appropriate.
The basics include caching, viewstate optimization etc. But what do you do to optimize
further, when you have implemented all the basic techniques? You search the Internet
to find an article about it, just like this one. The conclusion of this article is: Make the response from the server to the client as small as possible. You already
have made the server-side code run fast with the basic techniques, so now you need
to shrink the output. Here are a few examples that will take you a long way.
1. Remove whitespace in the HTML
This is very simple to do in ASP.NET. Here
is the method to use.
It can easily reduce your html code by 15%.
2. Remove whitespace and comments in CSS and JavaScript files.
This is also very simple. Read this
post on how that is done easily.
CSS code can be reduces by 30% and JavaScript about 15%-20%.
3. Put all styling in a stylesheet file
If you do a lot of styling in your html, the file size increases. Every time a page
loads the styling is also returned from the server. But if you put all your style
in a stylesheet, it will get cached by the browser and thereby only return from the
server once. This can be a great improvement if you have a lot on in-code styling.
4. Put all JavaScript in .js files
This uses the same principle as my point about putting all style in stylesheets.
Browsers caches .js files just like CSS files so itβs only returned from the server
once. Again, the impact of this trick is dependant on the amount of JavaScript you
use in your html page.
If you apply all four techniques, my guess is that you have reduced the response to
a minimum. If you pay for the bandwith used by the website, this could save you a
lot of money by reducing the filesize.
* $4.95/month BlogEngine.net Hosting β Click Here!