Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve ctor and dispose #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bollhals
Copy link

@bollhals bollhals commented May 1, 2021

PR 6 extracted out of #40

Focused on the Ctor & Dispose methods

Main change:

  • Preallocate some space for the dictionaries so they don't have to do this on the first resolve.
  • Avoid closure allocation on dispose

Performance measurements:

For the first point it's hard to show benefits, except that preallocation is faster than grow the internal size of the dictionary multiple times.

For the 2nd bullet I've created a small test that just dispose the container, but I haven't added it, as I do not believe it really adds much value, but for the sake of completness:

Method Mean Error StdDev Min Max Median Rank Gen 0 Gen 1 Gen 2 Allocated
Current 155.3 ns 1.91 ns 1.79 ns 152.7 ns 158.4 ns 155.2 ns 1 0.0763 - - 360 B
Master 226.8 ns 1.24 ns 0.97 ns 224.8 ns 228.1 ns 226.9 ns 1 0.1223 - - 576 B

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant