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

BasicProperties.ReadPropertiesFrom tends to resize the headers dictionary #1558

Open
danielmarbach opened this issue May 3, 2024 · 0 comments

Comments

@danielmarbach
Copy link
Collaborator

danielmarbach commented May 3, 2024

Is your feature request related to a problem? Please describe.

BasicProperties.ReadPropertiesFrom has quite a bit of allocations coming from resizing / growing the capacity of the properties dictionary.

image

I did have a first glance but it seems there is not a good way to determine the dictionary size needed as part of the WireFormatting.ReadDictionary because there we only get the header length as long which doesn't give as a hint about how many dictionary buckets we need.

Describe the solution you'd like

Ideally there would be a way to determine the number of buckets required to preallocate the capacity of the properties dictionary. THIS eliminates the need to perform a number of resizing operations while adding elements to the dictionary.

Describe alternatives you've considered

None

Additional context

None

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

No branches or pull requests

1 participant