Skip to content

feat: look for .ilean.mmap files on watchdog load#14421

Open
robsimmons wants to merge 3 commits into
masterfrom
milean-small
Open

feat: look for .ilean.mmap files on watchdog load#14421
robsimmons wants to merge 3 commits into
masterfrom
milean-small

Conversation

@robsimmons

@robsimmons robsimmons commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

This PR introduces a new, memory-mapped route to loading ilean objects into memory. This feature should be treated as undocumented and subject to change without notice in future releases.

Lean4web and Workbench memory requirements are, at present, somewhat dominated by the watchdog's ileans. Mmapping ileans has a similar unshared-memory reduction to just deleting them (which is how we've currently ameliorated the problem on live.lean-lang.org).

In my benchmarking (on OSX, with a mathlib nightly-testing 2026-07-15 compiled against this branch):

  • Creating .ilean.mmap files for just the .ilean files in Mathlib: watchdog needs 1.1G memory -> watchdog needs 496M memory
  • Creating .ilean.mmap files for all .ilean files, including those in the core release: watchdog needs 1.1G memory -> watchdog needs 393M memory.

This design looks for .ilean.mmap files aside .ilean files one time, on watchdog start, and only loads them if they report a file hash matching the current .ilean.hash. There's no mechanism for creating .ilean.mmap files, which is intentional: we only intend for this feature to be used for lean4web and workbench environments that we control at first so that we can back out of this design later on. For now, the only difference for users that don't go out of their way to create .ilean.mmap files in their .lake directories will be one failed file lookup per ilean.

For benchmarking I used robsimmons/milean, but I already have a better design for this in mind.

@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Jul 16, 2026
@mathlib-lean-pr-testing

mathlib-lean-pr-testing Bot commented Jul 16, 2026

Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 52edefc40e92425b6bb2671c01420b7f76fb6caf --onto a4b639c5a1e545677b36b09a4770b7b559df805b. You can force Mathlib CI using the force-mathlib-ci label. (2026-07-16 18:44:10)
  • ✅ Mathlib branch lean-pr-testing-14421 has successfully built against this PR. (2026-07-16 20:19:28) View Log
  • ✅ Mathlib branch lean-pr-testing-14421 has successfully built against this PR. (2026-07-17 14:21:13) View Log
  • ✅ Mathlib branch lean-pr-testing-14421 has successfully built against this PR. (2026-07-19 12:53:05) View Log

@leanprover-bot

leanprover-bot commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 52edefc40e92425b6bb2671c01420b7f76fb6caf --onto a4b639c5a1e545677b36b09a4770b7b559df805b. You can force reference manual CI using the force-manual-ci label. (2026-07-16 18:44:12)
  • ✅ Reference manual branch lean-pr-testing-14421 has successfully built against this PR. (2026-07-16 19:25:08) View Log
  • 🟡 Reference manual branch lean-pr-testing-14421 build against this PR didn't complete normally. (2026-07-16 19:27:26) View Log
  • ✅ Reference manual branch lean-pr-testing-14421 has successfully built against this PR. (2026-07-17 13:31:50) View Log
  • 🟡 Reference manual branch lean-pr-testing-14421 build against this PR didn't complete normally. (2026-07-17 13:33:39) View Log
  • ✅ Reference manual branch lean-pr-testing-14421 has successfully built against this PR. (2026-07-19 12:02:44) View Log
  • 🟡 Reference manual branch lean-pr-testing-14421 build against this PR didn't complete normally. (2026-07-19 12:04:04) View Log

@github-actions github-actions Bot added the mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN label Jul 16, 2026
@leanprover-bot leanprover-bot added the builds-manual CI has verified that the Lean Language Reference builds against this PR label Jul 16, 2026
@mathlib-lean-pr-testing mathlib-lean-pr-testing Bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Jul 16, 2026
@robsimmons
robsimmons marked this pull request as ready for review July 17, 2026 12:55
@robsimmons
robsimmons requested a review from mhuisi as a code owner July 17, 2026 12:55
mathlib-nightly-testing Bot pushed a commit to leanprover-community/batteries that referenced this pull request Jul 17, 2026
mathlib-nightly-testing Bot pushed a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Jul 17, 2026
leanprover-bot added a commit to leanprover/reference-manual that referenced this pull request Jul 17, 2026
@robsimmons robsimmons added the changelog-no Do not include this PR in the release changelog label Jul 17, 2026
… penalty to opening the same .ilean.mem file multiple times
mathlib-nightly-testing Bot pushed a commit to leanprover-community/batteries that referenced this pull request Jul 19, 2026
mathlib-nightly-testing Bot pushed a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Jul 19, 2026
leanprover-bot added a commit to leanprover/reference-manual that referenced this pull request Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

builds-manual CI has verified that the Lean Language Reference builds against this PR builds-mathlib CI has verified that Mathlib builds against this PR changelog-no Do not include this PR in the release changelog mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants