Bun's package manager achieves 7x faster installs than npm by treating package installation as a systems programming problem rather than a JavaScript one. Key optimizations include direct system calls in Zig (eliminating Node.js overhead), binary manifest caching, optimized tarball extraction with pre-allocation, cache-friendly data layouts using Structure of Arrays, OS-native file copying (clonefile on macOS, hardlinks on Linux), and lock-free multi-core parallelism. These techniques minimize expensive system calls and leverage modern hardware capabilities that traditional package managers don't fully utilize.

36m read timeFrom bun.com
Post cover image
Table of contents
The Problem with System CallsEliminating JavaScript overheadAsync DNS ResolutionBinary Manifest CachingOptimized Tarball ExtractionCache-Friendly Data LayoutOptimized Lockfile FormatFile copyingMulti-Core ParallelismConclusion

Sort: