Skip to content

perf: change passthrough compressor to avoid allocation#249

Open
mikhailofff wants to merge 1 commit intohit-box:mainfrom
mikhailofff:fix/issue-220
Open

perf: change passthrough compressor to avoid allocation#249
mikhailofff wants to merge 1 commit intohit-box:mainfrom
mikhailofff:fix/issue-220

Conversation

@mikhailofff
Copy link
Copy Markdown

Summary

  • Change compress(&[u8]) -> Vec to compress(&[u8]) -> Cow<[u8]> so passthrough compressor avoids allocation.
  • Change decompress(&[u8]) -> Vec to decompress(&[u8]) -> Cow<[u8]> as well.

Closes #220.

@AndreyErmilov
Copy link
Copy Markdown
Contributor

Hi @mikhailofff! Sorry for the late response, and thanks for your PR!
Regarding the code - I think Cow should use the ownership pattern here, since the compressor takes ownership. This would be semantically more correct.

Copy link
Copy Markdown
Author

@mikhailofff mikhailofff left a comment

Choose a reason for hiding this comment

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

Hi @AndreyErmilov. Thanks for your review. I hope all is good now.

@AndreyErmilov
Copy link
Copy Markdown
Contributor

Thank you! I ran the CI and there are a few errors there. Take a look at them please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compressor: return Cow<[u8]> for zero-copy passthrough

2 participants