Skip to content

feat: Allow configuring the number of decompression threads - #114

Open
denghongcai wants to merge 2 commits into
GoogleChrome:mainfrom
denghongcai:feat-configurable-threads
Open

feat: Allow configuring the number of decompression threads#114
denghongcai wants to merge 2 commits into
GoogleChrome:mainfrom
denghongcai:feat-configurable-threads

Conversation

@denghongcai

@denghongcai denghongcai commented Sep 27, 2025

Copy link
Copy Markdown

This change introduces a new --threads command-line option to allow users to manually specify the number of threads used for decompression. This is particularly useful in scenarios with high disk I/O latency but high bandwidth, where fine-tuning the thread count can improve performance.

To maintain backward compatibility, the existing --single-threaded flag is preserved and is made mutually exclusive with the new --threads option.

  • Added --threads argument to UnzipArgs in src/main.rs.

  • Used clap's conflicts_with attribute to ensure --single-threaded and --threads cannot be used together.

  • Initialized Rayon's global thread pool with the specified number of threads.

  • Updated the logic to treat --threads 1 as equivalent to --single-threaded.

  • Tests pass

  • Appropriate changes to README are included in PR

@mhansen

mhansen commented Dec 3, 2025

Copy link
Copy Markdown
Collaborator

This would fix #117

Comment thread src/main.rs
This change introduces a new `--threads` command-line option to allow users to manually specify the number of threads used for decompression. This is particularly useful in scenarios with high disk I/O latency but high bandwidth, where fine-tuning the thread count can improve performance.

To maintain backward compatibility, the existing `--single-threaded` flag is preserved and is made mutually exclusive with the new `--threads` option.

- Added `--threads` argument to `UnzipArgs` in `src/main.rs`.
- Used `clap`'s `conflicts_with` attribute to ensure `--single-threaded` and `--threads` cannot be used together.
- Initialized Rayon's global thread pool with the specified number of threads.
- Updated the logic to treat `--threads 1` as equivalent to `--single-threaded`.
@denghongcai
denghongcai force-pushed the feat-configurable-threads branch from 83ba8e6 to 53ee572 Compare December 6, 2025 14:26
@denghongcai
denghongcai requested a review from mhansen December 23, 2025 11:13
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.

2 participants