Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove reader allocation for compressors pools #792

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

emcfarlane
Copy link
Contributor

Small optimization to avoid allocating a new reader when recycling compressors by using http.NoBody.

Small optimization to avoid allocating a new reader when recycling
compressors by using `http.NoBody`.

Signed-off-by: Edward McFarlane <emcfarlane@buf.build>
@emcfarlane emcfarlane requested a review from jhump October 28, 2024 15:27
@@ -147,7 +148,7 @@ func (c *compressionPool) putDecompressor(decompressor Decompressor) error {
// know the compression format, we can't provide a valid header. Since we
// also reset the decompressor when it's pulled out of the pool, we can
// ignore errors here.
_ = decompressor.Reset(strings.NewReader(""))
_ = decompressor.Reset(http.NoBody)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😻 Love the attention to detail here.

@emcfarlane emcfarlane merged commit 74a6754 into main Oct 28, 2024
15 checks passed
@emcfarlane emcfarlane deleted the ed/noBodyCompressors branch October 28, 2024 17:29
@emcfarlane emcfarlane mentioned this pull request Jan 7, 2025
emcfarlane added a commit that referenced this pull request Jan 7, 2025
Below are the draft notes for the release:

----

# v1.18.0

## What's Changed
### Enhancements
* Add `package_suffix` option to `protoc-gen-connect-go` to allow
specifying the output directory of generated code by @bufdev and
@emcfarlane in #803
* Change stream client closures to be non-blocking by @emcfarlane in
#791
### Other changes
* Fix comment typo spelling of optimize by @yoshihiro-shu in
#786
* Remove reader allocation for compressors pools by @emcfarlane in
#792

## New Contributors
* @yoshihiro-shu made their first contribution in
#786

**Full Changelog**:
v1.17.0...v1.18.0

Signed-off-by: Edward McFarlane <emcfarlane@buf.build>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants