views:

61

answers:

3

Recently i came across a project that needed a lot of improvement. So i started searching the web for some techniques that could enhance the loading speed of this web application.

After a while i found some techniques but they gave me just a couple of seconds boost.

So, dear co-programmers, please fill in any coding/enhancing techniques you know.

I'll start with some of the more obvious:

  1. Don't use more than a 3 level nested loop.
  2. In ASP disable the viewstate for the controls that don't need it(e.g.: labels, divs, controls that have static values in general). (The main reason for this is that the viewstate is an encrypted and hashed value for the controls and therefor any control that does not need the viewstate just slows your app by executing encryption and hashing on it's value)

Thank you for your help, and eventually helping other juniors like me develop fast applications.

EDIT: also i found this on Visual Studio Magazine: http://visualstudiomagazine.com/articles/2005/11/01/optimize-aspnet-performance.aspx

+2  A: 

There are lots of options available for ASP.NET:

http://msdn.microsoft.com/en-us/library/44e5wy6k(VS.71).aspx

Adam
+1  A: 

Along with ASP.Net optimization, you should consider the other (client side, IIS level) improvements too

Check out the below link

Yahoo Best Practices for Speeding Up Your Web Site

Cheers

Ramesh Vel
+1  A: 

Assuming that you're using a database, the best optimization efforts that can make the highest impact are on the database level. Check your indexes, relationships and your queries. And Don't query information you don't need.

Other pitfalls usually ASP.NET developers fall through is the use of ADO.NET's embedded paging support. Custom paging should be used instead as indicated here.

Avoid storing big objects in Session and ViewState.

Also, since you're building a web site, you should make sure client files are not heavy on the user as Ramesh Vel suggested. Don't put images with printing quality on your website and avoid using heavy HTML pages. Also try to optimize your CSS files for example by grouping similar classes together, and using class inheritance

SiN
Personally i think that leaving some of the load to the client machine is a good idea because the server could have a lot of requests therefor some of the load needs to be handled by the client instead of the server, but just don't over do it
GxG
I don't think what you said is very accurate. Client logic and server logic are two totally different parts, and they don't usually share stress from the users.The basic scenario is as follows: User requests a page, Server executes the request, the page is returned to the client.As a matter of fact, putting load on the client will increase the load on the server and decrease user friendliness.For example, if you put images that have huge sizes, clients will have to wait longer to download them and the Web server will have to do more work to deliver the files.
SiN
That's true, but i was referring to making some of the server side code into client side code. for example if i have 2 dropdowns both of which are fully loaded by the server on first init, by selecting one value from the first the second should filter out irrelevant data. this could be done using client-side scripting therefor reducing the round trips to the server.
GxG