[Performance] Remove state parameter from FactoryDelegate - use FastExpressionCompiler with closure support

Issue #254 resolved
Maksim Volkau
repo owner created an issue

Instead of:

object[] singletons = new[] { new Singleton() };
Func<object[], object> f = state => new A((Singleton)state[0]);
var a = f(singletons);

Use:

var singleton = new Singleton();
Func<object> f = () => new A(singleton);
var a = f();

IL Emitting Factory Compiler will take care for emitting closure bound delegate.

DryIocZero does not use state already, therefore no blocking here.

Comments (3)

  1. Maksim Volkau reporter

    fixed: #254 [Performance] Remove state parameter from FactoryDelegate - use EmittingFactoryCompiler with closure support fixed: ArrayClosure emitting. added: Closure9 and Closure10 parameters changed: DI version to v3.0.0-rc1

    → <<cset b56a7575ff8d>>

  2. Log in to comment