uv 项目的第 21327 号 PR 为 wheel 缓存系统引入了文件级别的去重机制1。该实现在缓存中新增 files-v0 桶来存储经 BLAKE3 哈希的文件,通过硬链接将这些文件连接到 archive-v0 中的原始位置1。在保持现有安装流程不变的前提下,本地缓存容量可节省约 545.2 MiB,相当于减少约 10% 的缓存占用1。
这一优化的性能代价相对温和。冷启动安装速度下降约 4%,而热启动则不受影响1。缓存清理机制会在硬链接数降至 1 时删除文件对象,确保存储效率1。同步进行的 buffer 复用优化进一步改善了性能,将 PyTorch wheel 的缓冲区分配次数从 11,120 次降至 1 次,使冷启动速度改善了 7-9.5%1。
Pull request 21327 to the uv project introduces file-level deduplication across the wheel cache, reducing local storage consumption by approximately 545.2 MiB—roughly 10% of the cache footprint 1. The implementation stores each file in a files-v0 bucket identified by its BLAKE3 hash, with hard links pointing back to the original locations in archive-v0, ensuring the installation workflow remains unchanged 1.
The optimization comes with a performance trade-off: cold start installation speed decreases by approximately 4%, though warm starts experience no degradation 1. To maintain cache integrity, the system deletes file objects when their hard link count drops to one during cleanup operations 1. An additional optimization using buffer reuse further improves cold start performance by 7–9.5% for certain workloads, such as PyTorch wheel installations, by reducing buffer allocations from 11,120 down to a single allocation 1.
评论
还没有评论,欢迎留下第一条。