mirror of
https://github.com/pnpm/pnpm.git
synced 2026-07-23 14:13:09 -04:00
Adds @pnpm/agent.cafs-writer — a napi-rs crate that parses the binary /v1/files payload and writes each file to the CAFS in parallel. Wired into worker/src/start.ts as an optional native path; falls back to the existing JS streaming parser if the addon is not built for the host. Backends: - rayon + std::fs::write with O_CREAT|O_EXCL (default, all platforms) - tokio-uring on Linux (behind cfg(target_os = "linux")) End-to-end on the test-alot workload (1300 packages, warm agent server): native 19.3s js 23.3s (~17% slower) Microbench (parse + write only, darwin-arm64): 10000 × 1KB files native 1.8s vs js 8.3s (~4.5x) Toggle: set PNPM_CAFS_WRITER_DISABLE_NATIVE=1 to force the JS fallback. The native module is an optionalDependencies entry of @pnpm/worker and of the pnpm package (so the bundled CLI can resolve it at runtime).