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
Copy file name to clipboardExpand all lines: README.md
+4-5Lines changed: 4 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -34,8 +34,7 @@ DryIoc is fast, small, full-featured IoC Container for .NET
34
34
-[Extensions and Companions](Extensions.md)
35
35
-[Documentation][WikiHome]
36
36
-[Contribution guide](CONTRIBUTING.md)
37
-
- Check the old issues on [BitBucket](https://bitbucket.org/dadhi/dryioc)
38
-
- Two original parts of DryIoc are now separate projects: [FastExpressionCompiler](https://github.com/dadhi/FastExpressionCompiler) and [ImTools](https://github.com/dadhi/ImTools)
37
+
- Two original parts of the DryIoc are now the separate projects: [FastExpressionCompiler](https://github.com/dadhi/FastExpressionCompiler) and [ImTools](https://github.com/dadhi/ImTools)
39
38
40
39
## Benchmarks
41
40
@@ -172,8 +171,8 @@ Intel Core i7-8750H CPU 2.20GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical
172
171
* Service lifetime control via *Reuse* and lifetime scoping:
173
172
* Nested disposable scopes with optional names
174
173
* Optional ambient scope context
175
-
* Reuse types: `Transient`, `Singleton`, `Scoped` in multiple flavors (including scoping to the specific service ancestor in the object graph)
176
-
* Option to `useParentReuse` and to `useDecorateeReuse` for decorators
174
+
* Reuse types: `Transient`, `Singleton`, `Scoped` in multiple flavors including the scoping to the specific service ancestor in the object graph
175
+
* Option to `useParentReuse` and to `useDecorateeReuse`(for decorators)
177
176
* Option to `preventDisposal` and `weaklyReferenced`
178
177
* Open-generics support including type constraints, variance, complex nesting and recurring definitions.
179
178
* Constructor parameters injection and optional property and field injection.
@@ -183,7 +182,7 @@ Intel Core i7-8750H CPU 2.20GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical
183
182
* Nested with the relative order control
184
183
* Generic and non-generic
185
184
* With the Reuse possibly different from the decorated service
Copy file name to clipboardExpand all lines: docs/DryIoc.Docs/ResolutionPipeline.md
+8-7Lines changed: 8 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -9,28 +9,29 @@
9
9
10
10
## Overview
11
11
12
-
What happens when you call `container.Resolve<X>();` for the same service `X` multiple times in a sequence assuming that the `X` is not a singleton*:
12
+
What happens when you call the `container.Resolve<X>()` for the service `X` multiple times in a sequence assuming that the `X` is not a singleton*:
13
13
14
-
1. The first call will **discover and construct the expression tree** of `X` object graph, **interpret** the expression to get the service, and if succeeded will **cache the expression** in resolution cache.
15
-
2. The second call will find cached expression, will **compile** it to delegate, then it will **replace the cached expression with the delegate** and will invoke the delegate to get the service.
14
+
1. The first call will **discover and construct the expression tree** of `X` object graph, will **interpret** the expression to get the service, and if succeeded will **cache the expression** in the resolution cache, and will return the interpreted service.
15
+
2. The second call will find the cached expression, will **compile** it to the delegate, then it will **replace the cached expression with the delegate** and will invoke the delegate to get the service.
16
16
3. The third call will find the cached delegate and invoke it.
17
17
18
-
singleton* - those are always interpreted (cannot be changed via rules) and injected in object graph as `ConstantExpression` unless wrapped in Func or Lazy wrappers (which create singleton when consumer demand).
19
-
This is because they need to be created once and one-time interpretation is faster than compilation+invocation.
18
+
singleton* - those are always interpreted (this cannot be changed via rules) and injected in the object graph as a `ConstantExpression` unless wrapped in `Func` or `Lazy` wrappers (which create the singleton on demand).
19
+
The reason for that is the singletons are created once and the one-time interpretation is faster than the compilation+invocation.
20
20
21
21
22
22
## Relative Performance
23
23
24
+
- Delegate invocation is the fastest
24
25
- Expression interpretation is 10x times slower than the delegate invocation
25
-
- Delegate compilation is 100x slower than interpretation.
26
+
- Delegate compilation is 100x slower than the interpretation.
26
27
27
28
That's mean you need **once** to spend 100x more time than interpretation to get 10x boost,
28
29
and DryIoc by default is not paying this price.
29
30
30
31
31
32
## Rules.WithUseInterpretation
32
33
33
-
The compilation (essentially `System.Reflection.Emit`) is not supported by all targets, e.g. Xamarin iOS. In this case, you may specify to always use interpretation via
34
+
The compilation (essentially `System.Reflection.Emit`) is not supported by all targets, e.g. by the Xamarin iOS. In this case you may specify to always use the interpretation via the rule:
0 commit comments