dotnet/aspnetcore

Investigate improving DI container runtime codegen

Closed this issue · 2 comments

From @davidfowl on Tuesday, August 1, 2017 11:14:15 PM

We want to see if we can improve the performance of our DI container by looking at a few different things:

  • Reducing locks when resolving singletons/scoped services
  • Improving accessing fields of the closure passed into the compiled lambda expression. Today each access is an array access. It can be a field access (see https://github.com/dadhi/FastExpressionCompiler)

We also want to look at adding the ability to pre-compile the DI container to avoid any runtime cost at all. This is obviously tricky for things like open generics but we can fallback to a runtime implementation where possible.

/cc @pakrym

Copied from original issue: aspnet/DependencyInjection#564

From @dadhi on Wednesday, August 2, 2017 1:22:29 AM

@davidfowl

We also want to look at adding the ability to pre-compile the DI container to avoid any runtime cost at all.

I had a probably related question.

From @dzmitry-lahoda on Wednesday, August 2, 2017 5:14:35 AM

@davidfowl, I also want to see improvements in areas meantioned. But do you have any data that these improvements are important? What area is more important than other?