Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET - improve performance

Is there any reason use standart HTML controls (input type=text,input type=checkbox) instead of asp.net controls ( asp:TextBox, asp:CheckBox) to improve performance?

like image 524
Alexandre Avatar asked Nov 09 '10 14:11

Alexandre


People also ask

Why is my ASP.NET site so slow?

There can be numerous reasons why . NET applications can be slow. These include incorrect memory sizing, GC pauses, code-level errors, excessive logging of exceptions, high usage of synchronized blocks, IIS server bottlenecks, and so on.

How ASP.NET Core is faster?

Asynchronous via async/await Most modern applications spend most of their time and CPU cycles waiting for database queries, web service calls, and other I/O operations to complete. One of the reasons ASP.NET Core is faster is its extensive use of asynchronous patterns within the new MVC and Kestrel frameworks.


2 Answers

IMHO this would be a micro optimization. You will gain performance but it won't be noticeable. On the other hand you will loose much of the flexibility offered by the server controls.

You could try to reduce the size of the ViewState by disabling it for controls that don't need it. This will reduce the size of the generated pages and improve performance.

like image 103
Darin Dimitrov Avatar answered Sep 29 '22 06:09

Darin Dimitrov


The ASP.NET user controls will all have ViewState associated with them unless you explicitly set

EnableViewState="False"

As such, you will bloat the size of the underlying page if you have a large number of controls. As a general rule, use what meets your needs and nothing more.

  • Do you need to access the user control in the code-behind?
  • Do you need the control to maintain value across post-backs etc?

In most cases, it won't make a difference, but it is good to keep your page clean if you don't need these features.

like image 33
Chris Baxter Avatar answered Sep 29 '22 06:09

Chris Baxter