-
Notifications
You must be signed in to change notification settings - Fork 214
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
region: Simplify buffer funcs #258
Conversation
Replace `growBuffer` with 'append' and `resizeBufferCap` with `slices.Grow`. And remove redundant 'if' checks on capacity or size that `append` will do as well. This is equivalent behavior after undoing the unintentional change from commit 1fee39f. Benchmarks show the performance is equivalent to the code before commit 1fee39f. Also replace some deprecated calls to rand funcs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but QQ: how do you know the change to resizeBufferCap
was unintentional?
I spoke to @tsuna about it. He has no recollection of making that change and didn't mean to submit it with the other unrelated changes in #255. It causeed a slow down because an
This PR restores the previous performance. |
Thanks for fixing my mistake, I'm not sure how I managed to get that change in, when all I meant to do was to add a metric. |
Replace
growBuffer
withappend
andresizeBufferCap
withslices.Grow
. And remove redundantif
checks on capacity or size thatappend
will do as well. This is equivalent behavior after undoing the unintentional change from commit 1fee39f. Benchmarks show the performance is equivalent to the code before commit 1fee39f.Also replace some deprecated calls to rand funcs.