Skip to content

Refactor TraceState for fewer allocations #238

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

Merged
merged 2 commits into from
Oct 2, 2020
Merged

Conversation

jtescher
Copy link
Member

@jtescher jtescher commented Oct 2, 2020

Currently TraceState is a VecDeque because the spec has inserts moving the associated key to the front of the list. This is unfortunate as VecDeque will always allocate (see rust-lang/rust#68990).

This change addresses the issue by instead having TraceState store an Option<VecDeque<_>>, allowing the common case where there is no tracestate content to not heap allocate.

@jtescher jtescher requested a review from a team October 2, 2020 03:54
Copy link
Member

@frigus02 frigus02 left a comment

Choose a reason for hiding this comment

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

👍

@jtescher jtescher merged commit 0335f73 into master Oct 2, 2020
@jtescher jtescher deleted the tracestate-allocations branch October 2, 2020 16:40
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.

2 participants