leanprover / leanprover/lean4

RFC: Add `-j` option to `lake build` to control number of threads

Open
#4,241 2 comments 13 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Lake P-medium RFC
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

Proposal

Add a -j option to lake build to only spawn N compilation threads, similar to tools like make or cargo build.

If this is difficult to implement, it might be good enough to just print something akin to "Run LEAN_NUM_THREADS=8 lake build instead" and exit.

Motivation: compiling mathlib pegs all my CPU cores to 100% and takes a long time, making other tasks on my computer lag.

Community Feedback

Discussion on Zulip showed others ran into this as well, and the solution to use LEAN_NUM_THREADS=8 lake build is unstable and has low discoverability.

Impact

Add 👍 to issues you consider important. If others benefit from the changes in this proposal being added, please ask them to add 👍 to it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the lake build command and the Zulip discussion linked in the issue, then compare the proposed -j option with the existing LEAN_NUM_THREADS workaround. Done means defining and implementing the intended thread-limit behavior, or documenting and exposing the fallback clearly if the option is not feasible.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.