pub fn adjust_thread_pool() -> &'static Result<(), ThreadPoolBuildError>Expand description
Builds the global rayon pool, sized to the machine’s physical cores.
Rayon’s own default is one worker per logical CPU. On a machine with simultaneous multithreading that puts two workers on every core.
The prover’s hot loops are carry-less-multiply and bandwidth bound. A second worker on the same core competes for those ports and adds no throughput.
The environment still chooses the width when it says so:
RAYON_NUM_THREADS=1 one worker, running on the calling thread
RAYON_NUM_THREADS=n left to rayon, which reads the variable itself
unset one worker per physical coreA single-worker pool on the calling thread keeps worker frames out of stack traces.
Rayon builds the global pool on first use and refuses to build it twice. So this must run before anything else touches the pool. A later call reports that earlier use as an error, which a caller may treat as advisory.
The result is computed once and cached, so calling more than once is harmless.
§Returns
A reference, because the error type cannot be cloned.