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

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.

It is enabled only if the environment variable
`LEAN_EXPERIMENTAL_CHECK_FOR_MEMORY_BACKED_ILEANS` is true.

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 the ileans completely. (On
live.lean-lang.org we've just deleted them, which slightly degrades the
user experience.)

This design looks for `.ilean.mmap` files aside `.ilean` files one time,
on watchdog start, and prefers the `.ilean.mmap` file if it reports a
last-modified time that is greater than or equal to the `.ilean`'s
last-modified time.

If the environment variable is not set, the only change is the addition
of a check to ensure that an ilean doesn't get loaded more than once,
which will happen if multiple copies of the same folder end up on the
`LEAN_PATH`. For `.ilean` files, this double-load is essentially
harmless. For `.ilean.mmap` files, the second load is unable to use
file-backed storage and copies the file into its heap.

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. (The
[robsimmons/milean](https://github.com/robsimmons/milean) repository
shows one way of building these.) Unless someone goes out of their way
to create `.ilean.mmap` files in their `.lake` directories, this PR adds
the cost of one failed file lookup per ilean when the feature is
enabled.
2 files changed