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
perf: load --incr-load snapshot deps per module (#14023)
This PR makes `--incr-load` reload a snapshot's dependency `.olean*`
regions grouped by module, so each `CompactedRegion.read` only sees the
sibling variants it can actually point into rather than the full,
growing list of all previously-loaded regions. For an `import Mathlib`
snapshot this takes warm load time from ~30 s to ~0.8 s (now faster than
a fresh `import Mathlib`).
A regular `.olean*`'s only cross-region pointers are to the prior
variants of the same module (`.olean` <- `.olean.server` <-
`.olean.private`); cross-module references go through the constant map,
not direct region pointers. The old loader passed the whole growing
`depRegions` array to every read, so each read extracted and sorted an
`O(N)` dependency-view vector, i.e. `O(N²)` across the ~37k regions of
Mathlib, dominating load time.
The `<snap>.deps` sidecar is reshaped from a flat path list into a JSON
`Array ModuleArtifacts` (reusing the `--setup` artifact type),
reconstructed from `env.header.regions` at save time by
`regionsToModuleArtifacts`. The loader reads each module's variant chain
with only its own siblings as deps, reads any `.ir` region with no deps
(as regular import does), and passes the full accumulated set only to
the single final read of the snapshot region itself.
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments