Skip to content

Speedup take_bytes by precalculating capacity #7432

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

Open
Dandandan opened this issue Apr 21, 2025 · 0 comments · May be fixed by #7422
Open

Speedup take_bytes by precalculating capacity #7432

Dandandan opened this issue Apr 21, 2025 · 0 comments · May be fixed by #7422
Labels
enhancement Any new improvement worthy of a entry in the changelog

Comments

@Dandandan
Copy link
Contributor

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

We can precalculate the capacity of the value in take_bytes based on the offsets, while building the offsets.
This is faster than letting the buffer allocate for us.
As a bonus, we also save some memory by precisely allocating the resulting buffer, instead of overallocating.

Describe the solution you'd like

Describe alternatives you've considered

Additional context

@Dandandan Dandandan added the enhancement Any new improvement worthy of a entry in the changelog label Apr 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Any new improvement worthy of a entry in the changelog
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant