lean4-htt/tests/bench/inundation
Paul Reichert 98e4b2882f
refactor: migrate to new ranges (#8841)
This PR migrates usages of `Std.Range` to the new polymorphic ranges.

This PR unfortunately increases the transitive imports for
frequently-used parts of `Init` because the ranges now rely on iterators
in order to provide their functionality for types other than `Nat`.
However, iteration over ranges in compiled code is as efficient as
before in the examples I checked. This is because of a special
`IteratorLoop` implementation provided in the PR for this purpose.

There were two issues that were uncovered during migration:

* In `IndPredBelow.lean`, migrating the last remaining range causes
`compilerTest1.lean` to break. I have minimized the issue and came to
the conclusion it's a compiler bug. Therefore, I have not replaced said
old range usage yet (see #9186).
* In `BRecOn.lean`, we are publicly importing the ranges. Making this
import private should theoretically work, but there seems to be a
problem with the module system, causing the build to panic later in
`Init.Data.Grind.Poly` (see #9185).
* In `FuzzyMatching.lean`, inlining fails with the new ranges, which
would have led to significant slowdown. Therefore, I have not migrated
this file either.
2025-07-07 12:41:53 +00:00
..
.gitignore test: lake: add env & dep cfg benchmarks + cleanup 2023-09-22 20:31:48 -04:00
lakefile.lean refactor: migrate to new ranges (#8841) 2025-07-07 12:41:53 +00:00
README.md test: lake: add env & dep cfg benchmarks + cleanup 2023-09-22 20:31:48 -04:00

Stress Test for Lake

This folder generates a deeply nested import tree of Lean modules that can then be used as a stress test of large Lake builds (e.g., Mathlib). The modules lack any code. This removes variations in Lean elaboration time as a confounding factor, but also means this test cannot be used to profile features that depend on code size (e.g., OLean hashing or a module system).

It also generates a test workspace with many requires to benchmark the cost of importing a multi-package configuration.

Usage

This folder is tested as part of Lean's speed center benchmarks, but it can also be run manually like so:

lake run mkTree
lake -d=test/tree update
time lake -d=test/tree script run nop
lake run mkBuild
time lake build

These commands generate the mock packages and source files and then time a configuration import and a build.

Variations

The source generation configuration is flexible:

lake run -Ktest=Test mkBuild 40 40

The test option is which subdirectory of the Inundation source directory to output library files. The first number is the maximum dependency depth, and the second number is the number of dependencies for each file.

lake run mkTree 10

The number is how many dependency configurations to generate.

The settings in each example are the default values.

Credits

This test is a fork of Gabriel Ebner's GitHub repository. Thank him for the initial idea!