Benchmarks

Tests

We used the IoCPerformance Benchmarks from Daniel Palme

The Crosser Dependency Resolver was (as already mentioned) written for the needs in the Crosser Framework. The Resolver does not have all features and functions in a full DI/IoC framework, and certainly DOES NOT try to compete with all DI/IoC containers out there. Instead we aimed at being the best/fastest when is comes to the features needed for our realtime streaming framework.

Result

Not all frameworks in the original test was included our benchmark.

Disclaimer

  • We removed the slowest frameworks as well as the frameworks that broke during the test.
  • DryIoC was removed since we got exceptions in that test. No efforts to fix DryIoC was done but according to the tests from Daniel Palme DryIoC is very fast!
  • The tests was performed on .NET 4.5. The resolver supports dotnet core, but since the original tests was written for .NET 4.5 we used that for comparison.

Every interface is resolved 500.000 times during the benchmark and the time is measured in milliseconds. Each test is executed single threaded and multi threaded. Note that our multithreaded test was running 8 threads due to 8 logical processors on the test machine. The original test only ran 2 threads in the multithreaded tests.

Overview Fast Containers

Basic Fast

Overview Slow Containers

Basic Fast

Info

Note: The charts below has a logarithmic scale! This means that the difference is much bigger than you might think, see the x-axis values!

Details for Singleton

Numbers in bold is the fastest (lower is better)

Singleton

Container SingleThread MultiThread
No Container 40 22
Crosser 6 15
LightInject 34 18
fFastInjector 44 20
IfInjector 63 25
Func 102 38
Microsoft DI 136 259
Mef2 179 58
TinyIoC 350 345
Windsor 435 159
Unity 2630 707
Ninject 4055 2266

Details for Transient

Numbers in bold is the fastest (lower is better)

Transient

Container SingleThread MultiThread
No Container 49 34
Crosser 20 33
LightInject 38 32
fFastInjector 90 43
IfInjector 103 42
Func 151 46
Microsoft DI 99 42
Mef2 186 62
TinyIoC 1367 619
Windsor 1878 577
Unity 4207 1055
Ninject 13431 15402

Details for Combined

Numbers in bold is the fastest (lower is better)

Combined

Container SingleThread MultiThread
No Container 64 66
Crosser 76 46
LightInject 52 47
fFastInjector 193 69
IfInjector 127 59
Func 327 100
Microsoft DI 229 341
Mef2 256 87
TinyIoC 5966 2827
Windsor 5995 1715
Unity 10771 2819
Ninject 37867 21384

Details for Complex

Numbers in bold is the fastest (lower is better)

Complex

Container SingleThread MultiThread
No Container 78 42
Crosser 76 34
LightInject 71 36
fFastInjector 424 120
IfInjector 168 54
Func 899 254
Microsoft DI 623 1276
Mef2 424 130
TinyIoC 24243 11975
Windsor 16316 4866
Unity 32030 8063
Ninject 106870 69774

Details for Property

Numbers in bold is the fastest (lower is better)

Property

Container SingleThread MultiThread
No Container 98 45
Crosser 129 53
LightInject 85 44
fFastInjector - -
IfInjector 271 82
Func 922 260
Microsoft DI - -
Mef2 941 302
TinyIoC 3784 3454
Windsor 30911 9412
Unity 32069 8144
Ninject 91990 70747

Details for Enumerable

Enumerable

Numbers in bold is the fastest (lower is better). Not that not all containers support Enumerable.

Container SingleThread MultiThread
No Container 160 58
Crosser 195 69
LightInject 233 82
fFastInjector - -
IfInjector - -
Func - -
Microsoft DI 542 198
Mef2 1053 325
TinyIoC - -
Windsor 14947 4421
Unity 44844 11524
Ninject 86720 46211

Hardware

The benchmark was executed on the following machine:

  • Processor: Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz, 2301 Mhz, 4 Core(s), 8 Logical Processor(s)
  • Memory: 15,9 GB