Decompress 7z archives on the fly rather than extracting to disk#2931
Decompress 7z archives on the fly rather than extracting to disk#2931gantoine merged 2 commits intorommapp:masterfrom
Conversation
Summary of ChangesHello @Delgan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the efficiency and resource management of 7z archive processing by transitioning from a disk-based extraction method to a direct streaming approach. This change allows for on-the-fly data processing and hash calculation, thereby reducing reliance on temporary files and improving overall performance and system resource utilization. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the 7-Zip archive handling to decompress files on-the-fly by streaming from the 7zz process, instead of extracting to a temporary file on disk. This is a great optimization that reduces disk I/O and temporary storage requirements. My review focuses on the new implementation using subprocess.Popen. While the change is functionally correct for happy paths, I've identified a potential issue with the manual timeout implementation that could lead to the process hanging in certain edge cases. My feedback includes a detailed explanation of the issue and suggestions for improving robustness.
Description
It looks to me that we don't need to 7z archive to a temporary file and we can instead stream-decompress them, calculating the hases on the fly. It can't OOM since the pipes have a finite size.
Tested happy and timeout paths, it works well.
Checklist
Please check all that apply.
Screenshots (if applicable)