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

perf: store HashBuilder.value as a Vec<u8> and track kind separately #45

Closed
DaniPopes opened this issue Sep 27, 2024 · 0 comments · Fixed by #50
Closed

perf: store HashBuilder.value as a Vec<u8> and track kind separately #45

DaniPopes opened this issue Sep 27, 2024 · 0 comments · Fixed by #50
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@DaniPopes
Copy link
Member

The current API of HashBuilder::leaf creates a new allocation for each new value. This is wasteful, and should instead re-use an internal buffer like we're doing for RLP.

Practically, this means replacing value with a Vec<u8> and a separate flag to track whether it is a hash or a leaf value. The add_* APIs should remain the same, and internally they will clear the buffer, copy the new value in, and set the flag.

@DaniPopes DaniPopes added enhancement New feature or request good first issue Good for newcomers labels Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant