Mercurial > hg
comparison rust/hg-core/src/dirstate_tree/status.rs @ 49763:c52435820bbd stable
rust-status: fix thread count ceiling
This was forcing 16 threads instead of creating a ceiling, which is wrong
when either the available parallelism of the platform is lower or when
the user wants to set it explicitly (like we do in `run-tests.py`)
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Mon, 05 Dec 2022 17:28:40 +0100 |
parents | 363923bd51cd |
children | e0c0545e2e55 |
comparison
equal
deleted
inserted
replaced
49695:2c346c1c75ec | 49763:c52435820bbd |
---|---|
54 // threads makes `status` slower for each additional thread. | 54 // threads makes `status` slower for each additional thread. |
55 // We use `ok()` in case the global threadpool has already been | 55 // We use `ok()` in case the global threadpool has already been |
56 // instantiated in `rhg` or some other caller. | 56 // instantiated in `rhg` or some other caller. |
57 // TODO find the underlying cause and fix it, then remove this. | 57 // TODO find the underlying cause and fix it, then remove this. |
58 rayon::ThreadPoolBuilder::new() | 58 rayon::ThreadPoolBuilder::new() |
59 .num_threads(16) | 59 .num_threads(16.min(rayon::current_num_threads())) |
60 .build_global() | 60 .build_global() |
61 .ok(); | 61 .ok(); |
62 | 62 |
63 let (ignore_fn, warnings, patterns_changed): (IgnoreFnType, _, _) = | 63 let (ignore_fn, warnings, patterns_changed): (IgnoreFnType, _, _) = |
64 if options.list_ignored || options.list_unknown { | 64 if options.list_ignored || options.list_unknown { |