mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-22 05:59:31 +08:00
Program builds that import runtime bitcode parsed and merged every unit's whole module, although the import can only ever take small bodies that need no second copy of unit-local state. The helper now reduces a unit's bitcode to exactly that set when the runtime pack is built: the importable bodies within the size limit at their call distance from any public function, and the constants they copy. Every other definition becomes a declaration, as the import would treat it. A program's selection starts from public functions, so it is always a subset of the pruned set, and programs import the same bodies as before. `runtime-unit` writes the pruned bitcode for speed units; the new `prune-import` command prunes a unit's bitcode as compiled, for units whose objects the runtime compiler emits itself. Linux x64 speed bitcode shrinks from 17.0 MB to 8.6 MB. Runtime objects are byte-identical, and import lists match the unpruned bitcode exactly. Interleaved cold builds of 53 programs in a Linux Vercel Sandbox: speed went from +21.4% to +12.1% over release.