开发者

Coding Performance Enhancement for ASP.NET

开发者 https://www.devze.com 2023-01-07 15:22 出处:网络
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.

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


There are lots of options available for ASP.NET:

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


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消