You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In V3 I have removed Expression level cache stored once per Factory. This simlified a problem with condition based resolution, and removed a whole lot of adhoc checks.
Problem
This also introduced a problem of possibly multiple equivalent but not the same dependency expressions. In case when expression is or contains a lambda, the lambda will be compiled to different multiple delegates by FEC
Increased the size of result expession if it contains equivalent sub-expressions.
Solution
Memoize the built dependency expression into resolution root Request by the FactoryId. Exluding wrappers. Use the memoized expression instead of building a new one.
For open-generics we will use id of closed factory.
It is not a cache, cause it will be dropped when result expression is build and compiled.
This is similar to storing expression in a local var and using this var multiple times to build the result.
The text was updated successfully, but these errors were encountered:
Should improve #1 by faster compilation and tiny bit faster resolution, and less memory consumption. Because scoped service expression contains nested lambda.
Here is the benchmark of duplicated (multiple) vs. de-duplicated (shared) nested lambda.
The sample expression is: () => new A(() => new X(new Y()), new B(() => new X(new Y()))) where () => new X(new Y()) is duplicate: 5% faster and less memory too.
In V3 I have removed Expression level cache stored once per Factory. This simlified a problem with condition based resolution, and removed a whole lot of adhoc checks.
Problem
Solution
Memoize the built dependency expression into resolution root
Request
by theFactoryId
. Exluding wrappers. Use the memoized expression instead of building a new one.For open-generics we will use id of closed factory.
It is not a cache, cause it will be dropped when result expression is build and compiled.
This is similar to storing expression in a local
var
and using this var multiple times to build the result.The text was updated successfully, but these errors were encountered: