BoDi icon indicating copy to clipboard operation
BoDi copied to clipboard

improve performance of RegistrationKey

Open bollhals opened this issue 4 years ago • 0 comments

PR 1 extracted out of #40

Focused on the RegistrationKey. 2 main changes:

  • Implement IEquateable to avoid boxing in equality / hashcode methods
  • Cache the typegroup to improve the hashcode performance

Performance measurements:

From ResolveFromType, same performance, but less allocation

Method Mean Error StdDev Min Max Median Gen 0 Gen 1 Gen 2 Allocated
Master 220.3 ns 0.63 ns 0.56 ns 219.5 ns 221.3 ns 220.4 ns 0.0730 - - 344 B
Current 221.8 ns 2.19 ns 1.94 ns 220.3 ns 226.7 ns 220.9 ns 0.0577 - - 272 B

From ResolveFromGenericType, faster performance, less allocations

Method Mean Error StdDev Min Max Median Gen 0 Gen 1 Gen 2 Allocated
Current 676.1 ns 5.69 ns 5.32 ns 669.4 ns 685.6 ns 674.6 ns 0.0916 - - 432 B
Master 877.2 ns 5.14 ns 4.81 ns 869.9 ns 884.2 ns 877.6 ns 0.1068 - - 504 B
v1.4 829.0 ns 4.72 ns 4.42 ns 822.7 ns 838.0 ns 827.9 ns 0.0639 - - 304 B
v1.BoDi_Concurrent_Dictionary_And_Lazy 1,026.5 ns 4.18 ns 3.70 ns 1,020.5 ns 1,032.4 ns 1,025.6 ns 0.1564 - - 736 B

bollhals avatar Apr 20 '21 22:04 bollhals