Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the performance cost of autoeventwireup?

I have been looking at improving my ASP.NET page performance. Is it worth changing autoeventwireup from true to false and adding event handlers, or is the performance penalty very small?

This is an ASP.NET 2.0 project.

like image 803
PeteT Avatar asked Nov 02 '08 17:11

PeteT


People also ask

What is the use of AutoEventWireup in asp net?

When AutoEventWireup is true , ASP.NET does not require that you explicitly bind event handlers to a page event such as Load. When AutoEventWireup is true , handlers are automatically bound to events at run time based on their name and signature.

What is the meaning of AutoEventWireup true?

The AutoEventWireUp property when True, automatically wires up some of these built-in events in the Page life cycle to their handlers. This means that you do not need to explicitly attach these events (using the Handles keyword, for instance, in VB). Examples of these built-in events would be Page_Init and Page_Load .

Which attribute is an automatic way to bind the event to method?

The ASP.NET page framework supports an automatic way to associate page events and methods. If the AutoEventWireup attribute of the Page directive is set to true, the page framework calls page events automatically, specifically the Page_Init and Page_Load methods.


1 Answers

The wireup isn't done at compile-time. It's done at runtime. As described in this article:

http://odetocode.com/Blogs/scott/archive/2006/02/16/2914.aspx

There IS a performance penalty because of the calls to CreateDelegate which must be made every time a page has been created. The performance hit is probably negligible, but it does exist.

like image 131
Keltex Avatar answered Sep 21 '22 23:09

Keltex