-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
add benchmark for sql.RawBytes #945
Conversation
before.txt is master
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@vmg Please take a look. |
This comment has been minimized.
This comment has been minimized.
I'm sorry, #905 have not merged master branch. master branch merged connCheck which
|
@methane: Alright, I've had a chance to compare these results. Thanks for writing this benchmark! Very useful! For the benchmark you propose, the reason why the current version of #943 allocates more memory than Lines 64 to 73 in c81b5c7
If we remove the // grow buffer if necessary to fit the whole packet.
if need > len(dest) {
// Round up to the next multiple of the default size
dest = make([]byte, ((need/defaultBufSize)+1)*defaultBufSize)
b.dbuf[b.flipcnt&1] = dest
} FWIW this is what However: I don't think the benchmark you're proposing here tells the whole story. I think the benchmark I've updated in this pr is more interesting/accurate. I've changed two things in this benchmark:
So with this in mind, here are the results for my updated benchmarks:
|
@vmg First of all, I don't meant "your PR is worse performance!!". I know how to use micro benchmarks. I believe you know too.
I know. I didn't say it's bad. I just want to check allocation is expected, and check how much performance deltas before merging (or choosing) PRs.
Thanks. That's I want from code review.
That's intended. Cancelling is rare path. I want to know how much penalty on major path while fixing rare path. Sorry, it's 0:45am on my time zone. I'll check tomorrow. |
I know! I appreciate you writing these benchmarks to make sure we can merge a fix that doesn't regress performance. 🙇 |
It is not a problem because cancel is rare and RawBytes are rare. But...
I prefer #943 now too. While #905 diff is small, it uses something like ring buffer or deque. At this time, my top priority is fixing #903 without any regression and acceptable performance and |
Description
Added
BenchmarkQueryRawBytes
.Checklist