Latebinding or Webcontrols for best performance?

  • Thread starter Thread starter Weston Weems
  • Start date Start date
W

Weston Weems

I currently populate my datagrids manually from a
codebehind and use webcontrols within the template columns
(for check boxes and viewing pleasure eg labels)

For performance and scalability... would late binding
where I'd just have <%=myVar%> really be a better way of
doing things?

I always had thought creating a webcontrol and populating
from codebehind was more optimized becase it was pre-
compiled.

Thanks
Weston Weems
 
As far as asp.net goes, I wouldn't suggest using <%= %> if you can accomplish it from codebehind, it breaks the nice separation between code and html source. Compiled code is faster, and like you said using <%= %> doesn't get compiled until runtime, which takes a bit longer, but the performance difference wouldn't be anything to cry home about. As far as scalability, you'll want to stick with codebehind.

--Michael
 
Hrmm... I've heard arguments both ways... basically people
against the webcontrol's argument was simply that you had
to account for creation and gc of all the webcontrols.

Say I had a datagrid with 5 columns and 100 records, there
is 500 labels in memory (at least at the time of binding
anyway)

I could see how that route could cause some trouble in
resource management.

Anyway, anyone else have any input?


-----Original Message-----
As far as asp.net goes, I wouldn't suggest using <%= %>
if you can accomplish it from codebehind, it breaks the
nice separation between code and html source. Compiled
code is faster, and like you said using <%= %> doesn't get
compiled until runtime, which takes a bit longer, but the
performance difference wouldn't be anything to cry home
about. As far as scalability, you'll want to stick with
codebehind.
--Michael

"Weston Weems" <[email protected]>
wrote in message [email protected]...
 
Depends on what you're doing in the code-behind i.e. how many controls are
being created/modified and how much work is being done with the control
tree. I would suggest in most cases using the databinding syntax in your
webform (<%#%> latebound) is almost certainly slower and should be avoided
where possible.
Of course, the only way to totally understand the effects of either approach
is to test your application with a load testing tool such as ACT or
Microsoft's other stress tool (freely available) WAST or Homer as it is
known.
Making assumptions regarding performance is a risky business.
 
Every situation is unique, performance questions like these tend to be
slightly pointless (sorry). I'm not sure who's against web controls, my
guess is that they are doing very unique things (in which case asp.net as a
whole might not be well suited for there needs (although i even doubt this))
or they simply don't have much experience.

With performance, like most things, there's a law of diminishing return.
There are things you can spend minutes on to get huge gains (and you should
'cuz they are good practice)...what you are talking about will take you huge
time (maintenance and bugs) and gain your tiny performance gains (and you
shouldn't 'cuz its bad practice). Look at your own requirements if you need
an example. You could give yourself a headache by maintaining <%='s in 500
cells and gain 1/4 second per request. Or you could save yourself a lot of
trouble, create a solid caching strategy and gain 8 times that amount.

With performance, again like most things, things aren't black and white.
The extra performance you'll incur will save you $$$ in maintenance and
staff, which you could use to buy better hardware, which might cost you more
to host, but which might give you better uptime, which might.....


Karl
 
Back
Top