Achilles
Achilles

Reputation: 11309

What is the performance impact of LoadControl?

What is the performance impact of using Page.LoadControl in ASP .NET to load User Controls that are compiled outside of the "parent" application?

Upvotes: 0

Views: 1840

Answers (3)

Andy
Andy

Reputation: 11482

Beware: If you're creating the ascx file dynamically and then loading it, it will have to invoke csc (the c# compiler) every time you load the control, so you would be lucky to process 2 or 3 per second. If you're re-loading existing controls which have already been compiled, the overhead will be much smaller.

Upvotes: 1

Joop
Joop

Reputation: 2839

It also depends on how many controls you want to load and where in the Page life-cycle. A few controls is okay for the performance, if it isn't too complex as said by Joseph. However when you add 20/30/or more controls every step in your life-cycle will dramatically increase.

Upvotes: 0

Joseph
Joseph

Reputation: 25523

That completely depends on the complexity of the control you're loading into the page.

Upvotes: 1

Related Questions