diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-12 18:04:39 +0100 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-12 18:04:39 +0100 |
| commit | f00a7ac44843fb84bd0c43acf458f3e440b7a893 (patch) | |
| tree | e153e385ad4cc1ed1a9c2315f109f956980826b2 /src/GraphicObjects/GraphicObject.cs | |
| parent | 1a0b8d56f3a0f1922e01f9e6ef6d07b847ae62a8 (diff) | |
comments
Diffstat (limited to 'src/GraphicObjects/GraphicObject.cs')
| -rw-r--r-- | src/GraphicObjects/GraphicObject.cs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index d5f0e295..610d97f1 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -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); |