Comments (16)
Here is the proof: benchmark, sut and the related epic #44
DryIoc v3:
CreateContainerAndRegisterServices_Then_FirstTimeOpenScopeAndResolve
Method | Mean | Error | StdDev | Ratio | RatioSD | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op |
---------------------------------- |------------:|-----------:|-----------:|-------:|--------:|------------:|------------:|------------:|--------------------:|
BmarkMicrosoftDependencyInjection | 128.3 us | 1.591 us | 1.489 us | 1.00 | 0.00 | 13.7939 | - | - | 58.66 KB |
BmarkAutofac | 425.8 us | 2.081 us | 1.947 us | 3.32 | 0.05 | 76.6602 | 2.4414 | - | 354.91 KB |
BmarkAutofacMsDi | 434.9 us | 1.827 us | 1.709 us | 3.39 | 0.03 | 80.0781 | 0.4883 | - | 371.22 KB |
BmarkGrace | 17,839.6 us | 99.023 us | 87.781 us | 138.99 | 1.72 | 156.2500 | 62.5000 | - | 781.49 KB |
BmarkGraceMsDi | 20,568.8 us | 116.222 us | 108.714 us | 160.39 | 2.00 | 187.5000 | 93.7500 | 31.2500 | 954.13 KB |
BmarkDryIoc | 47,340.9 us | 175.076 us | 146.196 us | 368.47 | 3.79 | 90.9091 | - | - | 759.4 KB |
BmarkDryIocMsDi | 46,669.8 us | 302.005 us | 282.496 us | 363.92 | 4.44 | 181.8182 | 90.9091 | - | 855.37 KB |
OpenScopeAndResolve
Method | Mean | Error | StdDev | Ratio | RatioSD | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op |
---------------------------------- |----------:|----------:|----------:|------:|--------:|------------:|------------:|------------:|--------------------:|
BmarkMicrosoftDependencyInjection | 3.407 us | 0.0131 us | 0.0116 us | 1.00 | 0.00 | 0.8354 | - | - | 3.87 KB |
BmarkGrace | 3.954 us | 0.0102 us | 0.0095 us | 1.16 | 0.01 | 1.8921 | - | - | 8.73 KB |
BmarkGraceMsDi | 5.253 us | 0.0126 us | 0.0111 us | 1.54 | 0.01 | 2.2736 | - | - | 10.49 KB |
BmarkDryIoc | 25.944 us | 0.0288 us | 0.0270 us | 7.61 | 0.03 | 3.8757 | - | - | 17.88 KB |
BmarkDryIocMsDi | 29.552 us | 0.0841 us | 0.0746 us | 8.67 | 0.04 | 4.7302 | - | - | 21.94 KB |
BmarkAutofac | 40.997 us | 0.1914 us | 0.1790 us | 12.04 | 0.08 | 10.8643 | - | - | 50.23 KB |
BmarkAutofacMsDi | 51.114 us | 0.2980 us | 0.2788 us | 15.00 | 0.08 | 14.1602 | - | - | 65.39 KB |
DryIoc v4 (preview-02)
CreateContainerAndRegisterServices_Then_FirstTimeOpenScopeAndResolve
Method | Mean | Error | StdDev | Ratio | RatioSD | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op |
---------------------------------- |------------:|------------:|------------:|-------:|--------:|------------:|------------:|------------:|--------------------:|
BmarkMicrosoftDependencyInjection | 134.0 us | 2.1675 us | 2.0275 us | 1.00 | 0.00 | 13.7939 | 0.1221 | - | 58.65 KB |
BmarkDryIoc | 145.3 us | 0.8318 us | 0.7374 us | 1.08 | 0.02 | 30.2734 | - | - | 140.35 KB |
BmarkDryIocMsDi | 161.6 us | 0.9626 us | 0.9004 us | 1.21 | 0.02 | 32.2266 | - | - | 149.19 KB |
BmarkAutofacMsDi | 665.2 us | 5.4804 us | 5.1264 us | 4.96 | 0.08 | 105.4688 | 3.9063 | - | 487.64 KB |
BmarkAutofac | 673.2 us | 5.5615 us | 5.2022 us | 5.02 | 0.08 | 101.5625 | 18.5547 | - | 470.39 KB |
BmarkGrace | 18,480.8 us | 100.5977 us | 89.1773 us | 137.83 | 2.35 | 156.2500 | 62.5000 | - | 755.18 KB |
BmarkGraceMsDi | 21,640.4 us | 119.7309 us | 106.1383 us | 161.39 | 2.81 | 187.5000 | 93.7500 | 31.2500 | 926.88 KB |
OpenScopeAndResolve
Method | Mean | Error | StdDev | Ratio | RatioSD | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op |
---------------------------------- |----------:|----------:|----------:|------:|--------:|------------:|------------:|------------:|--------------------:|
BmarkMicrosoftDependencyInjection | 3.222 us | 0.0138 us | 0.0129 us | 1.00 | 0.00 | 0.8354 | - | - | 3.87 KB |
BmarkDryIoc | 4.274 us | 0.0276 us | 0.0259 us | 1.33 | 0.01 | 1.9531 | - | - | 9.02 KB |
BmarkDryIocMsDi | 4.498 us | 0.0237 us | 0.0222 us | 1.40 | 0.01 | 1.9608 | - | - | 9.06 KB |
BmarkGrace | 4.604 us | 0.0271 us | 0.0254 us | 1.43 | 0.01 | 2.3499 | - | - | 10.85 KB |
BmarkGraceMsDi | 5.280 us | 0.0267 us | 0.0236 us | 1.64 | 0.01 | 2.2202 | - | - | 10.24 KB |
BmarkAutofac | 37.600 us | 0.5655 us | 0.5289 us | 11.67 | 0.16 | 9.3994 | 0.0610 | - | 43.47 KB |
BmarkAutofacMsDi | 49.487 us | 0.4901 us | 0.4585 us | 15.36 | 0.13 | 13.3667 | 0.1221 | - | 61.75 KB |
from dryioc.
It's conceivable that on .net core 2.1 you might get a similar boost by enabling tiered compilation.
It's certainly worth trying out; if that really works well, it might render the interpretation of expression trees themselves moot (because the JIT would be interpreting IL, and the conversion to IL is fairly fast with FastExpressionCompiler).
from dryioc.
COMPlus_TieredCompilation
true | false |
---|---|
1,2543458 | 1,1927924 |
1,1643181 | 1,7478098 |
1,1927924 | 1,3724727 |
1,1572949 | 1,413623 |
avg | avg |
1,1921878 | 1,431674475 |
Probes in seconds.
In my case it seems mostly faster, thanks for the info.
from dryioc.
Yes, this is a general problem on my working machine (it's a laptop), as suggested here. I assume it's a CPU boost / throttling Problem. But my measurements gives an idea that COMPlus_TieredCompilation=true is faster at cold start.
from dryioc.
@Fruchuxs Hi, thanks for bringing it.
First, what platform did you target?
Next, there maybe a more work involved, considering that on some platforms DryIoc uses custom expression compiler.
But everything is possible. In FEC we probably immediately fallback to Expression.Compile
when preferInterpretation: true
is passed.
from dryioc.
We also tested the FEC, but the speed up was in our cases negligible.
Thanks for your acceptance.
from dryioc.
@Fruchuxs, what platform did you test?
from dryioc.
Oh sorry, forget to advise: .net core 2.1
from dryioc.
Hi @EamonNerbonne , are you suggesting to add <TieredCompilation>true</TieredCompilation>
and check?
from dryioc.
Yeah, that would be a start ;-).
But I have no experience with that (new) feature, so can't tell you about any gotchas - I mean I hope there aren't any, but it's conceivable it doesn't work with dynamically generated IL or some such thing. Only one way to find out! ;-).
from dryioc.
Will check but their measurements doesn't look promising.
from dryioc.
Just a little worried about the high variance in those numbers - it might just be chance.
from dryioc.
Cool actually. I was sceptical, but it is a visible difference. Moreover, it affects dynamic methods as well.
Thanks for trying!
from dryioc.
#45 should help.
from dryioc.
Looks nice, now we need this Version out. :P
Any release plans?
EDIT: Btw. really good work!
from dryioc.
Wow... It's coooool
from dryioc.
Related Issues (20)
- Consistent behavior of a faulty singleton HOT 2
- FactoryType is not forwarded in the RegisterMapping<TService, TRegisteredService> method HOT 1
- IDisposable dependencies does not get disposed when web request ends HOT 5
- Add the HotUsedInstance for fast access to skip all the resolution steps
- Conditional registrations
- MS DI AddKeyed... variant registration fails HOT 8
- Check for mismatch lifestyle scope between service and dependencies HOT 7
- troubleshooting sudden ArgumentException at TryInterpretSingletonAndUnwrapContainerException HOT 3
- [question/feature request] keyed services in delegate resolution HOT 8
- Use default constructor if no registration is found
- Add the global test option to run all tests with WithoutUseInterpretation option
- Feature Request: add global .WithDefaultServiceTypeCondition(Func<Type, bool> condition) method HOT 1
- System.NullReferenceException: Object reference not set to an instance of an object HOT 5
- 'WithConcreteTypeDynamicRegistrations' results in unintended instantiation HOT 3
- Exception: Window already exists HOT 4
- Resolve enforces passed arguments to be used (and fails because of it) HOT 4
- Type registered with Singleton instantiating multiple times
- [BUG] Resolve<> crashes with the misleading, casting-related Exception when class is also registered using RegisterInitializer HOT 5
- Virus Warning with DryIoc Version 5.4.3 on Some Antivirus Software HOT 1
- Resolving func-wrapper when having circular-dependency throws RecursiveDependencyDetected HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dryioc.