Rust bundled runtime installation spends avoidable CPU time decompressing gzip archives
- 主要语言
- Java
- 星标
- 10.5k
- 派生
- 1.5k
- 平均合并
- 1 天 14 小时
- 30 天内合并 PR
- 129
描述
### Status: architecture first
Following the maintainer's recommendation in #2678, address the architectural installation cost first without adding a decompression backend. #2676 is the owning implementation PR for single-pass streaming and trusted build-generated per-file hashes/metadata that allow valid warm verification without decompressing the archive. Retain the existing miniz_oxide backend and preserve content integrity, permissions, repair behavior, bounded memory, and concurrency guarantees.
The backend experiment in #2678 is now a draft and is deferred. Reconsider zlib-rs only after the architectural work lands and fresh matched cold/warm/repair benchmarks plus release binary-size measurements demonstrate a worthwhile remaining benefit. Earlier measurements against the eager installer are historical evidence, not post-architecture results.
### Problem
At upstream revision `9553d5224c73df2d02aee5ec01eeb8353acc736a`, the Rust bundled runtime installer traverses the same embedded gzip archive repeatedly and reconstructs large entries even during warm verification. Installer-only measurements show avoidable decompression and allocation costs.
### Reproduction
Build the Rust SDK in release mode with its default `bundled-cli` feature and the pinned shipped runtime. In a fresh process with an isolated HOME, time the public `github_copilot_sdk::install_bundled_runtime()` API. Repeat with a fresh process against the same valid installation. Do not launch a CLI process, authenticate, or make a model request. Compare cold installation, valid warm verification, same-size corrupted runtime.node, and runtime.node truncated to 1024 bytes.
### Evidence required
Use matched source/compiler/profile/runtime/archive identities and repeated alternating before/after processes. Compare output digests, sizes and modes; report latency, CPU, peak and retained memory, and release binary size. Prove valid warm verification reads no archive bytes while still checking installed content against trusted build-generated metadata rather than mutable cache markers.
### Deferred backend tradeoff
flate2 documents the byte-slice adapter and backend options at https://docs.rs/flate2/1.1.9/flate2/. zlib-rs requires no C compiler but adds unsafe dependency internals. Any future backend proposal must justify that tradeoff with evidence on the completed architecture, not the old repeated-traversal implementation.
贡献指南
调研方向
从公开的 github_copilot_sdk::install_bundled_runtime() API 以及 issue 中描述的 bundled runtime installer 开始。使用固定的 runtime 和 archive 标识(包括摘要、模式、内存、CPU 和 release binary 大小),测量匹配的冷启动、热启动和修复场景。完成的标准是:有效的热启动验证不读取任何 archive 字节,同时保持完整性、权限、修复行为、有界内存和并发保证。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- rust
- 领域
- build-system, performance
- Issue 类型
- 重构
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100