Skip to main content

Module pool

Module pool 

Source
Expand description

The worker pool of a command (“Kizz never panics”).

A command that has parallel work builds one WorkerPool before that work, and passes it to the code that needs it: a rayon pool of as many threads as std::thread::available_parallelism gives, at most MAX_WORKERS, and 1 when it gives an error. Each worker starts through kizz_threads, which waits and retries while the system cannot start a thread for the moment, and never panics; a worker that still cannot start makes WorkerPool::new return the error, and rayon stops the workers that started.

The cache check, the recording of observations, cache cleanup, BLAKE3’s parallel hashing and the discovery walk run inside the pool, through WorkerPool::install, so BLAKE3’s rayon::join runs on it too, and rayon’s global pool, which panics when it cannot start a thread, never starts.

Structs§

PoolError
A worker pool that could not be built because a worker could not start.
WorkerPool
The pool of threads that runs a command’s parallel work.

Constants§

MAX_WORKERS
The most threads a worker pool has. The measurement report times the check of 10,000 cached steps at 0.73 seconds with 4 threads, 0.83 seconds with 1, and 1.53 seconds with the default pool of 32 threads.