Skip to content

Remove redundant BufReaders for decompressing tar archives#6317

Merged
kskalski merged 3 commits intoanza-xyz:masterfrom
kskalski:ks/perf/tarzstd_buf
Jun 6, 2025
Merged

Remove redundant BufReaders for decompressing tar archives#6317
kskalski merged 3 commits intoanza-xyz:masterfrom
kskalski:ks/perf/tarzstd_buf

Conversation

@kskalski
Copy link
Copy Markdown

@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
Copy Markdown

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
Copy Markdown

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
Copy Markdown
Author

kskalski commented Jun 5, 2025

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

Copy link
Copy Markdown

@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
Copy Markdown

@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
Copy Markdown

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.

@kskalski kskalski added the v2.3 label Jun 6, 2025
@mergify
Copy link
Copy Markdown

mergify Bot commented Jun 6, 2025

Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis.

mergify Bot pushed a commit that referenced this pull request Jun 6, 2025
* perf: remove redundant BufReaders for decompressing tar archives

* Format

* Switch bzip2 decoder to read

(cherry picked from commit da1b789)
brooksprumo pushed a commit that referenced this pull request Jun 9, 2025
* perf: remove redundant BufReaders for decompressing tar archives

* Format

* Switch bzip2 decoder to read

(cherry picked from commit da1b789)
brooksprumo pushed a commit that referenced this pull request Jun 9, 2025
…kport of #6317) (#6453)

Remove redundant BufReaders for decompressing tar archives (#6317)

* perf: remove redundant BufReaders for decompressing tar archives

* Format

* Switch bzip2 decoder to read

(cherry picked from commit da1b789)

Co-authored-by: Kamil Skalski <kamil.skalski@gmail.com>
mircea-c pushed a commit to mircea-c/agave that referenced this pull request Jun 12, 2025
…6317)

* perf: remove redundant BufReaders for decompressing tar archives

* Format

* Switch bzip2 decoder to read
mircea-c added a commit to mircea-c/agave that referenced this pull request Jun 12, 2025
…6317)

* perf: remove redundant BufReaders for decompressing tar archives

* Format

* Switch bzip2 decoder to read
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