Skip to content

perf(rust): evaluate gzip backend after installer optimization - #2678

Closed
mohamedmansour wants to merge 3 commits into
github:mainfrom
mohamedmansour:mohamedmansour-rust-gzip-performance
Closed

mohamedmansour wants to merge 3 commits into
github:mainfrom
mohamedmansour:mohamedmansour-rust-gzip-performance

Conversation

@mohamedmansour

@mohamedmansour mohamedmansour commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Decision: Closed in favor of the miniz-only architectural improvements in #2676. We are not pursuing zlib-rs.

Proof: In the matched macOS benchmark, the architecture alone makes cold installation 27% faster, warm verification 46% faster, and repairs 23-24% faster. Warm retained physical memory falls from 174.35 to 1.76 MiB. Measured revisions: 9553d522 to 4ab7f873.

Safety: Keep the existing backend, bounded streaming, trusted file verification, and repair behavior. Native Windows/Linux validation remains tracked in #2676. Full measurements and reproduction.

Use flate2's zlib-rs runtime backend and decode embedded slices directly. Keep build-time compression and installer verification behavior unchanged; cover gzip boundaries and malformed inputs.\n\nRefs github#2677

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 15, 2026 20:49
@mohamedmansour
mohamedmansour requested a review from a team as a code owner September 15, 2026 20:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused backend optimization preserves existing behavior and includes appropriate regression coverage.

Pull request overview

Optimizes Rust bundled gzip extraction without changing installer behavior or public APIs.

Changes:

  • Enables flate2’s zlib-rs runtime backend.
  • Uses bufread::GzDecoder for embedded byte slices.
  • Adds gzip integrity and extraction regression tests.
File summaries
File Description
rust/src/embeddedcli.rs Updates decoding paths and adds contract tests.
rust/Cargo.toml Selects the optional zlib-rs backend.
rust/Cargo.lock Locks zlib-rs 0.6.8.
Review details
  • Files reviewed: 2/3 changed files
  • Comments generated: 0
  • Review effort level: Balanced (auto)

Note

Copilot is running an experiment and ran this review at Balanced.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@stephentoub

Copy link
Copy Markdown
Collaborator

The underlying installer performance problem is real, but I recommend addressing the architectural cost first without adding a new decompression backend. install_runtime currently traverses the same embedded gzip archive three times for the normal runtime and four times with bundled-in-process; warm verification also reconstructs large entries. Consolidating installation into a single streaming traversal and using build-generated hashes or metadata to avoid decompression for valid warm installs should provide a larger end-to-end improvement while retaining the existing miniz_oxide dependency.

After that work lands, benchmark cold, warm, and repair paths again and compare release binary sizes. If raw inflate time is still material, zlib-rs can then be evaluated as a focused second-stage optimization with evidence that its remaining gain justifies the added dependency and unsafe implementation surface.

Generated by Copilot

Comment thread rust/Cargo.toml
Use backend-neutral ZIP features with zlib-rs. Exercise the shared ZIP extractor on every test host and run ZIP/gzip installer coverage in native bundled CI.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@mohamedmansour
mohamedmansour marked this pull request as draft September 16, 2026 04:30
@mohamedmansour mohamedmansour changed the title perf(rust): speed up bundled gzip decompression with zlib-rs perf(rust): evaluate gzip backend after installer optimization Sep 16, 2026
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