-
Notifications
You must be signed in to change notification settings - Fork 18
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
feat: optimize LZMA processing with enhanced multiReader implementation for io.ByteReader #95
Conversation
I'm slightly confused as your PR and benchmark performance references LZMA2, but the reader you've changed is only used for LZMA(1) streams; there's a separate reader used for LZMA2. |
@bodgit thanks for reply. |
In some cases there are actually two folder 0 in an archive. If the archive headers are compressed and/or encrypted then there is a separate compressed stream which contains a single folder that holds the archive headers/metadata, as well as the usual folder 0 (... & 1, 2, etc.) that holds the compressed file contents. In the case of the
So I suppose my question is, is this folder 0 in your archive the compressed headers, or is it the first folder containing some/all of the compressed files? I don't necessarily have a problem with the PR as such, just trying to understand where the slowdown is. Is the LZMA2 reader going to suffer the same problem, given it uses the same |
Compressed headers.
LZMA2 Reader passes io.ReadCloser directly to the xz package, so this is not a problem. |
benchstat:
|
I've merged this PR and released it as v1.4.3. If/when the xz package is updated and contains your fix, I'll create a further release. Thanks for the contribution! |
This pull request aims to optimize the LZMA2 processing in the
github.com/bodgit/sevenzip
project by enhancing the usage ofgithub.com/ulikunitz/xz
library for io.ByteReader.The current implementation doesn't fully leverage the optimizations provided by
github.com/ulikunitz/xz
due to its usage of io.MultiReader. As a result, the proposed change modifies the code to return a custom implementation of multiReader based on io.ReadCloser when io.ByteReader is implemented.The optimized multiReader implementation exhibits significant performance improvements, especially when handling large 7z archives. While the impact might be limited for smaller inputs, it can provide an efficiency boost of nearly 10% for larger files.
before:
after:
I kindly request your review and feedback on this pull request. Thank you for considering this contribution.