Prevent module-object substitution timeouts#2
Open
ebmoon wants to merge 5 commits into
Open
Conversation
ebmoon
changed the base branch from
v9.2+typewise-isomorphism-dev
to
v9.2+typewise-isomorphism
July 21, 2026 19:12
ebmoon
force-pushed
the
fix/module-substitution-timeout
branch
from
July 21, 2026 19:12
8556da4 to
1de45c0
Compare
ebmoon
marked this pull request as ready for review
July 22, 2026 00:29
Member
Author
JasonGross
approved these changes
Jul 22, 2026
JasonGross
left a comment
Member
There was a problem hiding this comment.
This seems good at a glance, please also submit upstream to rocq (or I can submit upstream if you prefer)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Large module parameters containing many substitutive objects no longer spend
minutes rebuilding delta-resolver maps before their bodies are elaborated.
Sequential substitutions are now retained as a bounded, serializable
composition and normalized in balanced rounds, preserving the existing
Mod_subst.joinlaw while removing eager work from the repeatedLibobject.Refpath.The compiled-object checker understands the new representation, and the
regressions cover module paths, canonical kernel names, constants, inductives,
constructors, projections, inline bodies, resolver domain/codomain transforms,
functor parameters, includes,
with Module, rollback/replay, Marshal roundtrips, and skewed long chains.
Performance
Measurements used an isolated switch where Rocq, ELPI, Lean import,
QuickChick, and the snapshot dependencies were rebuilt against one OCaml ABI.
runATestinterfaceztautointerfaceOn the synthetic parameter-load profile, the same 69
joincalls went from 68resolver substitutions and 185 delta folds to zero of each. This is measured
hot-path evidence, not a claim of a specific asymptotic bound.
Validation
dune build rocq-runtime.install rocq-core.installMod_substunit characterizations pass, including 10,000 left-associated joins and bounded right-associated joinsModuleObjectSubstitutionChain.v,IncludeSelfChain.v, andTescik.vcompile and passrocqchkProbeBaseline.v: 2.13 s, 595,004 KiB RSSProbeNoImport.v: 1.22 s, 597,432 KiB RSSrunATest: 10.73 s, 938,184 KiB RSSztauto: 8.60 s, 552,204 KiB RSSdune build @checkcould not complete in the local switch because the optionallablgtk3-sourceview3andcamlzippackages are absent; both affected Rocqinstall targets above build cleanly.
Known limitation
The representative
genCheckertarget no longer times out and reaches itsgenerated body in 29.42 s (586,392 KiB RSS), where it encounters an existing
generated-relation type mismatch (
A_Rhas typeA1 -> A2 -> TypebutPRUnivalent A1 A2is expected). That downstream generator error is separatefrom module-parameter loading and is not changed here.
Post-Deploy Monitoring & Validation
This is compiler-internal rather than a live service change. Healthy signals
are green module/
rocqchkCI, downstream interface builds completing withoutgen_subst_delta_resolverdominating parameter loading, and no time/RSSregressions on large module signatures. Revert this PR if CI finds substitution
semantic differences, compiled-object validation failures, or material
small-workload regressions; validate through this PR's CI and the next
downstream QuickChick rebuild, owned by the Rocq maintainers and downstream
package maintainers respectively.