aspnet / DependencyInjection

[Archived] Contains common DI abstractions that ASP.NET Core and Entity Framework Core use. Project moved to https://github.com/aspnet/Extensions
Apache License 2.0
873 stars 318 forks source link

ILEmit backend for DependencyInjeciton #630

Closed pakrym closed 6 years ago

rynowak commented 6 years ago

I see Emit and I upvote ❤️ 🔥 🍺

pakrym commented 6 years ago

Before/After BuildServiceProvider with Scoped->Scoped->Scoped tree

25% faster, ~3x less allocations in count and size

image

image

jawn commented 6 years ago

Typo alert in PR title: DependencyInjeciton > DependencyInjection

davidfowl commented 6 years ago

@jawn thanks 😄

davidfowl commented 6 years ago

@pakrym why is the built red?

Zoxive commented 6 years ago

I see the new test does 350 dependencies deep. Is this the new "limit"? (I see there are test files still included for 999) I'll grab this branch and try it out tomorrow with my breaking project from https://github.com/aspnet/Home/issues/2737

Zoxive commented 6 years ago

@pakrym Works great. Also as @davidfowl mentioned about the build failing i had to add readonly to the struct properties to get it to compile locally as well.

C:\projects\dependencyinjection\src\DI\ServiceLookup\ILEmit\ILEmitCallSiteAnalysisResult.cs(19,20): error CS8340: Instance fields of readonly structs must be readonly. [C:\projects\dependencyinjection\src\DI\DI.csproj]