]> O.S.I.I.S - jp/crow.git/commitdiff
comments
authorjpbruyere <jp.bruyere@hotmail.com>
Fri, 12 Feb 2016 17:04:39 +0000 (18:04 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Fri, 12 Feb 2016 17:04:39 +0000 (18:04 +0100)
src/GraphicObjects/GraphicObject.cs

index d5f0e29585ceeb791ec847853ce12ec75ce4a4d3..610d97f1c601a1c70ad54e759606fe28c6b40d95 100644 (file)
@@ -428,7 +428,13 @@ namespace Crow
                                Interface.DefaultValuesLoader[thisType.FullName] (this);
                                return;
                        }
-                       
+
+                       //Reflexion being very slow compared to dyn method or delegates,
+                       //I compile the initial values coded in the CustomAttribs of the class,
+                       //all other instance of this type would not longer use reflexion to init properly
+                       //but will fetch the  dynamic initialisation method compiled for this precise type
+                       //TODO:measure speed gain.
+                       #region Delfault values Loading dynamic compilation
                        DynamicMethod dm = null;
                        ILGenerator il = null;
 
@@ -554,6 +560,7 @@ namespace Crow
                                il.Emit (OpCodes.Callvirt, pi.GetSetMethod ());
                        }
                        il.Emit(OpCodes.Ret);
+                       #endregion
 
                        Interface.DefaultValuesLoader[thisType.FullName] = (Interface.loadDefaultInvoker)dm.CreateDelegate(typeof(Interface.loadDefaultInvoker));
                        Interface.DefaultValuesLoader[thisType.FullName] (this);