2

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

GxG
  • 4,491
  • 2
  • 20
  • 18
  • 1
    There is not one definitive answer here, I suggest you make it community wiki else I bet this will be closed before you can say "robinson crusoe" – Rippo Jul 15 '10 at 09:40
  • 1
    The best optimazations will probably be achieved with improving the design. http://downloads.gamedev.net/pdf/gpbb/gpbb1.pdf – MrFox Jul 15 '10 at 09:46
  • well, I have specify some points here in my answer, please take alook http://stackoverflow.com/questions/1340218/asp-net-website-slow-performance-on-production-server/1340629#1340629 – Muhammad Akhtar Jul 15 '10 at 09:46
  • @rippo thanks for the notice! didn't know about the wiki @mrfox from what i've read in that book the main focus is on low level applications, assembler-type of thinking, in the .NET you have to think just a little bit different than on the asm. but anyway, good book, it's worth taking a look at it! – GxG Jul 15 '10 at 10:07

3 Answers3

2

There are lots of options available for ASP.NET:

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

Adam Houldsworth
  • 63,413
  • 11
  • 150
  • 187
2

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
  • 3,704
  • 2
  • 31
  • 36
  • 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 Jul 15 '10 at 10:52
  • 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 Jul 15 '10 at 12:02
  • 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 Jul 15 '10 at 12:21
1

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

RameshVel
  • 64,778
  • 30
  • 169
  • 213