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

Reduce TxPool allocations #6970

Merged
merged 7 commits into from
May 3, 2024
Merged

Reduce TxPool allocations #6970

merged 7 commits into from
May 3, 2024

Conversation

benaadams
Copy link
Member

@benaadams benaadams commented May 2, 2024

Changes

  • Don't allocate Linq for .ToArray snapshot
  • Invert the flow to pass method into the iterator, rather than passing enumerator out

Removes the following allocations
image

Types of changes

What types of changes does your code introduce?

  • Optimization
  • Refactoring

Testing

Requires testing

  • No

@benaadams benaadams requested a review from marcindsobczak May 2, 2024 15:40
@benaadams benaadams requested a review from LukaszRozmej May 2, 2024 15:45
@benaadams benaadams marked this pull request as ready for review May 2, 2024 15:45
@benaadams benaadams requested review from asdacap and kamilchodola May 2, 2024 15:47
Copy link
Member

@LukaszRozmej LukaszRozmej left a comment

Choose a reason for hiding this comment

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

Overall looks good, but I want @marcindsobczak to review this as well.

How much allocation does it save? All the marked ones?

@benaadams
Copy link
Member Author

How much allocation does it save? All the marked ones?

Yep

@benaadams
Copy link
Member Author

How much allocation does it save? All the marked ones?

Top allocations on master + PR now looks like this

image

Copy link
Member

@LukaszRozmej LukaszRozmej left a comment

Choose a reason for hiding this comment

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

Approve from me, but please don't merge until @marcindsobczak reviews!

@benaadams
Copy link
Member Author

Top allocations on master + PR now looks like this

With string changes

image

Copy link
Contributor

@marcindsobczak marcindsobczak left a comment

Choose a reason for hiding this comment

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

Looks good. Took me a while to understand what is going on here, but actually it is just delegating low level update logic to be triggered from TxPool instead of TxDistinctSortedPool. I don't see any inconsistencies

@benaadams benaadams merged commit 836ff88 into master May 3, 2024
67 checks passed
@benaadams benaadams deleted the txpool branch May 3, 2024 09:45
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.

3 participants