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

Remove TrieStore allocations by using ArrayPoolList #4353

Merged
merged 2 commits into from
Aug 2, 2022

Conversation

LukaszRozmej
Copy link
Member

Changes:

  • Remove TrieStore allocations by using ArrayPoolList
  • Small refactors

Types of changes

What types of changes does your code introduce?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Other (please describe):

Testing

Requires testing

  • Yes
  • No

In case you checked yes, did you write tests??

  • Yes
  • No


List<BlockCommitSet> candidateSets = new();
while (_commitSetQueue.TryDequeue(out BlockCommitSet? frontSet))
using ArrayPoolList<BlockCommitSet> toAddBack = new(_commitSetQueue.Count * 2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why *2?

Copy link
Member Author

@LukaszRozmej LukaszRozmej Aug 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To have headroom if the queue grows during pruning, with reallocating List it might not be needed, what do you think?

Default ArrayPool gives you I think at least 8, plus gives you always power of 2.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also feel free to review ArrayPoolList code, though it is used in our code without issues already.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I will remove it

@LukaszRozmej LukaszRozmej merged commit 69348c5 into master Aug 2, 2022
@LukaszRozmej LukaszRozmej deleted the remove-triestore-allocations branch August 2, 2022 15:41
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.

None yet

2 participants