But are you using the label server controls for a reason? You should only
use server controls when needed for a specific purpose. If you are using
them because they are convenient, then your performance will suffer.
People will tend to use these even when a page does not need then such as an
add page (simply accepts data to add). Developers might be tempted to create
the server controls for the textboxes because they think it is appropriate,
but why not just use the HTML page to put an HTML textbox with name and then
onsubmit use the Page.Request.Params["FORM_ELEMENT_NAME"] to get its value.
Just because server controls are there (and make development easier) does
not mean they are the best to use in all situations.
Fred
kdub said:
I know about viewstate. It does help to turn it off, but performance is
still much worse when using controls. There is a 10% performance gain for
eliminating 5 labels in my example below.
Am I missing something, or are .NET Server Controls another 'easy to
develop, bad to use in the real world' tool?
I Don't mean to be pessimistic, i want to find a way to use them without the
performance hit.
-- Results --
frmA.aspx
No Controls, I have 5 functions that return a string in the CodeBehind, and
5
<%= funGetString1 %> tags in the ASPX page
Final Results
-------------
Total Run Time: 00:00:02:00
Total Iterations: 29,314
Total Requests: 56,307
Avg Requests/sec: 469
Avg Time to First Byte (msecs): 8.36
Avg Time to Last Byte (msecs): 8.40
HTTP Errors: 527
DNS Errors: 0
Socket Errors: 2,387
----------------------------------------
frmB.aspxControls
5 labels whose text property gets set in the OnLoad Event
ViewState is disabled on all labels
Final Results
-------------
Total Run Time: 00:00:02:00
Total Iterations: 26,530
Total Requests: 50,809
Avg Requests/sec: 423
Avg Time to First Byte (msecs): 9.86
Avg Time to Last Byte (msecs): 9.90
HTTP Errors: 76
DNS Errors: 0
Socket Errors: 2,298