This commit is contained in:
Shannon
2020-07-14 10:08:59 +10:00
parent 51c338f04b
commit 212dc7f0fa
2 changed files with 5 additions and 1 deletions
@@ -542,8 +542,10 @@ namespace Umbraco.ModelsBuilder.Embedded
if (modelInfos.TryGetValue(typeName, out var modelInfo))
throw new InvalidOperationException($"Both types {type.FullName} and {modelInfo.ModelType.FullName} want to be a model type for content type with alias \"{typeName}\".");
// fixme use Core's ReflectionUtilities.EmitCtor !!
// TODO: use Core's ReflectionUtilities.EmitCtor !!
// Yes .. DynamicMethod is uber slow
// TODO: But perhaps https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.constructorbuilder?view=netcore-3.1 is better still?
// See CtorInvokeBenchmarks
var meth = new DynamicMethod(string.Empty, typeof(IPublishedElement), ctorArgTypes, type.Module, true);
var gen = meth.GetILGenerator();
gen.Emit(OpCodes.Ldarg_0);
@@ -16,6 +16,8 @@ namespace Umbraco.Tests.Benchmarks
// - it's faster to get+invoke the ctor
// - emitting the ctor is unless if invoked only 1
// TODO: Check out https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.constructorbuilder?view=netcore-3.1 ?
//[Config(typeof(Config))]
[MemoryDiagnoser]
public class CtorInvokeBenchmarks