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

Reduce allocations in fixBound #798

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pencil
Copy link

@pencil pencil commented Jan 28, 2022

Reduces allocations by initializing bytes.Buffer with correct target capacity.

benchmark                  old ns/op     new ns/op     delta
BenchmarkFixBound10-8      346           324           -6.42%
BenchmarkFixBound100-8     1410          1170          -17.02%

benchmark                  old allocs     new allocs     delta
BenchmarkFixBound10-8      4              3              -25.00%
BenchmarkFixBound100-8     7              3              -57.14%

benchmark                  old bytes     new bytes     delta
BenchmarkFixBound10-8      354           273           -22.88%
BenchmarkFixBound100-8     3294          2082          -36.79%

@pedia
Copy link

pedia commented May 5, 2022

@jmoiron WDYT about merging this?

1 similar comment
@pedia
Copy link

pedia commented May 5, 2022

@jmoiron WDYT about merging this?

@dlsniper dlsniper added the could merge The PR look safe enough to merge label Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
could merge The PR look safe enough to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants