Fix signaling available_token_condvar when a new token is received

This slightly improves performance on systems with many cores and
barely affects systems with few cores.

My laptop (2 core + HT):
Before:
Benchmark 2: RUSTC=rustc /home/bjorn/Projects/cg_clif2/./dist/cargo-clif build --manifest-path /home/bjorn/Projects/cg_clif2/./download/simple-raytracer/Cargo.toml --target-dir /home/bjorn/Projects/cg_clif2/./build/simple_raytracer
  Time (mean ± σ):     12.042 s ±  0.313 s    [User: 29.434 s, System: 4.720 s]
  Range (min … max):   11.670 s … 12.795 s    10 runs

After:
Benchmark 2: RUSTC=rustc /home/bjorn/Projects/cg_clif2/./dist/cargo-clif build --manifest-path /home/bjorn/Projects/cg_clif2/./download/simple-raytracer/Cargo.toml --target-dir /home/bjorn/Projects/cg_clif2/./build/simple_raytracer
  Time (mean ± σ):     12.037 s ±  0.384 s    [User: 29.960 s, System: 4.722 s]
  Range (min … max):   11.673 s … 12.769 s    10 runs

Dev desktop (32 cores)
Before:
Benchmark 2: RUSTC=rustc /home/gh-bjorn3/cg_clif/./dist/cargo-clif build --manifest-path /home/gh-bjorn3/cg_clif/./download/simple-raytracer/Cargo.toml --target-dir /home/gh-bjorn3/cg_clif/./build/simple_raytracer
  Time (mean ± σ):     10.425 s ±  0.104 s    [User: 25.877 s, System: 5.513 s]
  Range (min … max):   10.267 s … 10.640 s    10 runs

After:
Benchmark 2: RUSTC=rustc /home/gh-bjorn3/cg_clif/./dist/cargo-clif build --manifest-path /home/gh-bjorn3/cg_clif/./download/simple-raytracer/Cargo.toml --target-dir /home/gh-bjorn3/cg_clif/./build/simple_raytracer
  Time (mean ± σ):     10.212 s ±  0.100 s    [User: 25.918 s, System: 5.555 s]
  Range (min … max):   10.079 s … 10.362 s    10 runs
This commit is contained in:
bjorn3 2023-02-10 18:08:39 +00:00
parent 7870b296e4
commit 4a1c2d9c7c

View File

@ -32,7 +32,7 @@ pub(super) fn new(sess: &Session, pending_jobs: usize) -> Self {
ConcurrencyLimiter {
helper_thread: Some(helper_thread),
state,
available_token_condvar: Arc::new(Condvar::new()),
available_token_condvar,
finished: false,
}
}