BoDi icon indicating copy to clipboard operation
BoDi copied to clipboard

improve performance / allocations on CreateObject / ResolveArgument

Open bollhals opened this issue 4 years ago • 0 comments

PR 4 extracted out of #40

Focused on the CreateObject / ResolveArgument Main change:

  • avoid closure delegate allocation due to LINQ usage
  • simplify CreateObject
  • avoid allocation when no parameters required

Performance measurements: Added new benchmarks that always create a new object

ResolveFromType:

Method AsSingleton Mean Error StdDev Min Max Median Rank Gen 0 Gen 1 Gen 2 Allocated
Current True 232.5 ns 1.24 ns 1.16 ns 230.8 ns 234.3 ns 232.5 ns 1 0.0730 - - 344 B
Master True 232.6 ns 0.64 ns 0.57 ns 231.6 ns 233.6 ns 232.6 ns 1 0.0730 - - 344 B
Current False 358.0 ns 3.38 ns 3.16 ns 353.9 ns 364.9 ns 357.0 ns 2 0.0696 - - 328 B
Master False 628.6 ns 6.21 ns 5.81 ns 618.5 ns 639.3 ns 628.2 ns 2 0.1459 - - 688 B

ResolveFromFactory

Method AsSingleton Mean Error StdDev Min Max Median Rank Gen 0 Gen 1 Gen 2 Allocated
Current True 250.7 ns 2.96 ns 2.76 ns 247.5 ns 255.5 ns 249.5 ns 1 0.0763 - - 360 B
Master True 250.4 ns 3.11 ns 2.91 ns 246.8 ns 254.7 ns 250.9 ns 1 0.0763 - - 360 B
Current False 915.3 ns 8.02 ns 7.50 ns 904.8 ns 929.6 ns 913.1 ns 2 0.1421 - - 672 B
Master False 1,088.2 ns 4.72 ns 4.18 ns 1,081.9 ns 1,093.5 ns 1,088.9 ns 2 0.1755 - - 832 B

bollhals avatar Apr 24 '21 21:04 bollhals