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

Use a deque for the ring buffer for better dequeue performance #182

Merged
merged 3 commits into from
Dec 19, 2024

Conversation

mlw
Copy link
Contributor

@mlw mlw commented Dec 19, 2024

Replaces the underlying type of the ring buffer to be a std::deque. Previously this was a std::vector. While we had reserved space for the vector which would prevent growth and make Enqueue always cheap. Dequeue ops would still require shifting the items in the vector. std::deque gets rid of this limitation.

There is a tradeoff in memory usage here as std::deque will use more. But current use cases only require small ring buffers. If we ever need larger ring buffers, we should move to a more robust ring buffer implementation that manages it's own contiguous memory.

@mlw mlw added this to the 2025.1 milestone Dec 19, 2024
@mlw mlw requested a review from a team as a code owner December 19, 2024 15:45
@github-actions github-actions bot added the size/s Size: small label Dec 19, 2024
@mlw mlw marked this pull request as draft December 19, 2024 15:47
@mlw mlw marked this pull request as ready for review December 19, 2024 15:56
@mlw mlw merged commit 0e750ca into northpolesec:main Dec 19, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/s Size: small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants