Skip to content

Remove redundant BufReaders for decompressing tar archives #6317

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

Merged
merged 3 commits into from
Jun 6, 2025

Conversation

kskalski
Copy link

@kskalski kskalski commented May 27, 2025

Problem

ZSTD Decoder::new creates buf reader with tuned size already, other decoders handle buffering too:

In those cases wrapping reader with BufReader is counter-productive or unnecessary (bzip2 provides both bufread and read decoders)

Summary of Changes

Remove redundant BufReaders for decompressing tar archives when underlying decompressor is already doing buffering.

@codecov-commenter
Copy link

codecov-commenter commented May 27, 2025

Codecov Report

Attention: Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 82.8%. Comparing base (103fb21) to head (71e2436).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master    #6317     +/-   ##
=========================================
- Coverage    82.8%    82.8%   -0.1%     
=========================================
  Files         847      847             
  Lines      379488   379486      -2     
=========================================
- Hits       314349   314309     -40     
- Misses      65139    65177     +38     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vadorovsky vadorovsky self-requested a review May 27, 2025 21:14
@brooksprumo brooksprumo self-requested a review June 4, 2025 17:28
@brooksprumo
Copy link

ZSTD Decoder::new creates buf reader with tuned size already (https://github.com/gyscos/zstd-rs/blob/229054099aa73f7e861762f687d7e07cac1d9b3b/src/stream/read/mod.rs#L29), most others have some form of buffering too, so wrapping reader with BufReader is counter-productive.

Thanks for the link to where zstd creates its own BufReader. Can you also provide links for gzip and lz4 too, since this PR is changing them as well.

@kskalski
Copy link
Author

kskalski commented Jun 5, 2025

Sure, I'm also switching bzip2 decoder as it has appropriate wrapper. Updated description.

Copy link

@brooksprumo brooksprumo left a comment

Choose a reason for hiding this comment

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

Looks good to me. I think you'll need to rebase to pull in newer commits that fix the CI.

@kskalski kskalski force-pushed the ks/perf/tarzstd_buf branch from f9eacaf to 57a86cc Compare June 5, 2025 18:02
@kskalski kskalski force-pushed the ks/perf/tarzstd_buf branch from 57a86cc to 71e2436 Compare June 6, 2025 09:24
@brooksprumo brooksprumo self-requested a review June 6, 2025 14:34
Copy link

@brooksprumo brooksprumo left a comment

Choose a reason for hiding this comment

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

:shipit:

@kskalski kskalski merged commit da1b789 into anza-xyz:master Jun 6, 2025
47 checks passed
@kskalski kskalski deleted the ks/perf/tarzstd_buf branch June 6, 2025 14:41
@brooksprumo
Copy link

Let's also backport this to v2.3. We'll need to wait for #6430 to land, and then please add the "v2.3" label to kickoff the backport.

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.

3 participants