[Mono-devel-list] PROPOSED PATCH: small optimization in TemplateControl
eric lindvall
eric at 5stops.com
Tue Jan 27 18:22:27 EST 2004
I found a small potential optimization in the TemplateControl class.
I'm not sure if it makes sense that this code would be faster than the
last, but my benchmarks showed a speedup with the change.
e.
-------------- next part --------------
Index: class/System.Web/System.Web.UI/TemplateControl.cs
===================================================================
RCS file: /mono/mcs/class/System.Web/System.Web.UI/TemplateControl.cs,v
retrieving revision 1.16
diff -u -p -u -r1.16 TemplateControl.cs
--- class/System.Web/System.Web.UI/TemplateControl.cs 22 Oct 2003 12:06:00 -0000 1.16
+++ class/System.Web/System.Web.UI/TemplateControl.cs 28 Jan 2004 00:29:31 -0000
@@ -77,12 +77,22 @@ namespace System.Web.UI {
Type type = GetType ();
foreach (MethodInfo method in type.GetMethods (bflags)) {
- int pos = Array.IndexOf (methodNames, method.Name);
- if (pos == -1)
- continue;
+ string name = method.Name;
- string name = methodNames [pos];
- pos = name.IndexOf ("_");
+ switch (method.Name)
+ {
+ case "Page_Init":
+ case "Page_Load":
+ case "Page_DataBind":
+ case "Page_PreRender":
+ case "Page_Dispose":
+ case "Page_Error":
+ break;
+ default:
+ continue;
+ }
+
+ int pos = name.IndexOf ("_");
if (pos == -1 || pos + 1 == name.Length)
continue;
More information about the Mono-devel-list
mailing list