Mercurial > hg-stable
changeset 43463:37cbf45bb858 stable
rust-threads: force Rayon to respect the worker count in config
As per the inline comment, this is a workaround because Rust code does not yet
know how to read config files.
Differential Revision: https://phab.mercurial-scm.org/D7610
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Sun, 10 Nov 2019 07:30:14 -0800 |
parents | 612b4b63fb22 |
children | 578c42f998d9 |
files | mercurial/dirstate.py |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dirstate.py Mon Dec 09 12:29:46 2019 +0100 +++ b/mercurial/dirstate.py Sun Nov 10 07:30:14 2019 -0800 @@ -1116,6 +1116,17 @@ use_rust = False if use_rust: + # Force Rayon (Rust parallelism library) to respect the number of + # workers. This is a temporary workaround until Rust code knows + # how to read the config file. + numcpus = self._ui.configint("worker", "numcpus") + if numcpus is not None: + encoding.environ.setdefault(b'RAYON_NUM_THREADS', b'%d' % numcpus) + + workers_enabled = self._ui.configbool("worker", "enabled", True) + if not workers_enabled: + encoding.environ[b"RAYON_NUM_THREADS"] = b"1" + ( lookup, modified,