danielpalme / IocPerformance

Performance comparison of .NET IoC containers
https://danielpalme.github.io/IocPerformance
Apache License 2.0
874 stars 157 forks source link

Interception unfairly skewing benchmarks #139

Closed ENikS closed 2 years ago

ENikS commented 4 years ago

I would like to suggest a small improvement to your benchmarks. It has to do with how your setup threats interception.

Generally interception extension severely degrades any container's performance. (Unity, for example, does not recommended it for new development). I once sent you a PR with removed interception, but you added it back.

If you insist on testing interception, perhaps you could test it as a separate case and load the extension only for interception benchmarks? Right now you are loading it for all tests and slow container down by order of 2 or 3.

This issue affects all containers with support for interception and skews results in favor of containers without the interception support.

To demonstrate my point here are few numbers:

This is how for your benchmark setup by default:

Unity 5.11.7                                 Single      Multi
 Singleton                                      166        105
 Transient                                     1092        582
 Combined                                      2651       1388
 Complex                                       6600       3407
 Property                                      6690       3536
 Generics                                      6119       3173
 IEnumerable                                  12140       6706
 Conditional                                   2337       1222

and this is benchmark with disabled interception:

Unity 5.11.7                                 Single      Multi
 Singleton                                      202        112
 Transient                                      270        159
 Combined                                       945        540
 Complex                                       2955       1608
 Property                                      3137       1672
 Generics                                      2501       1320
 IEnumerable                                   4255       2655
 Conditional                                    599        338

The difference is quite significant.

danielpalme commented 4 years ago

Would you like to create a PR?