You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Run cache: skip the runtime-beam copy on a cache hit #662
On a run-cache hit, the toolchain still copies every prebuilt runtime beam (141 .beam files, 1.5 MB, about 16 ms) into the output directory before restoring the cached program.
Why it can't simply be skipped
tryLoadRunCacheFrom (src/driver/toolchain.cxx) checks for a hit and restores in one call: it validates manifest.txt and, as a side effect, copies every cached .beam into outputDir. The restore has to land after the prebuilt copy. Otherwise a stale prebuilt copy of a stdlib module the program merged from source (Kex.URI, … via resolveBeamDeps) wins, which is the #27env.query shape.
Doing this means splitting the check from the restore: validate the manifest and file presence first, then restore after the copy decision. Even then, a hit can't skip the copy wholesale. Execution still needs kex_prelude.beam and the other runtime beams, so only the same-named subset the restore is about to overwrite can be skipped.
Measured (no code written)
Only Kex.* stdlib modules (76 files, 552 KB) can collide. 3 of 644 specs merge an opt-in module from source, one module each. With a generous upper bound of 5 merged modules, that is about 5/141 of the copy: about 0.6 ms on the hit path, 0 ms for programs that merge no stdlib source.
Deferred: a ceiling of about 1 ms doesn't justify check/restore surgery next to a kex#27-shaped hazard. Revisit if the copy set or the cost changes.
Activity