Perforamce of User Controls ?

  • Thread starter Thread starter Manish Jain
  • Start date Start date
M

Manish Jain

Platform: ASP.Net/C# / Framework 1.1/Windows 2000 Server

I am thinking of using User Controls for some tasks which I perform on
nearly all pages like:
1) Page Title with different Captions
2) Address Information forms
3) List of Users
etc.

My Application would be running in an ASP mode and thousands of users would
use it simultaneously, so I need to keep a strict check on performace.

After compilations, Is there a overhead in Page Loading wrt User Controls?
What I want to know is that would my page load any slower (even if
marginally) if I use say 4-5 User Controls on it instead of corresponding
code directly?

Regards,
Manish
 
Any user controls are going to incur the expense of having to be created
(constructors), then have their events called (in addition to the page
events), and then rendered with respect to their rendering code. So there
is going to be a small overhead to using User Controls. You can get by some
of this overhead by caching content at a user control level (fragment
caching) so that each time the page is hit the user controls aren't actually
run, but instead the HTML they generated the first time through is actually
placed into your response stream verbatim.

User controls make a lot of sense from a code manageability point, so don't
let a few extra milliseconds dissuade you from using them. Used properly
with caching/fragment caching they can be quite fast and powerful.
 
Back
Top