Mercurial > hg
comparison mercurial/dirstate.py @ 43505:47fac1692ede
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/D7310
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Sun, 10 Nov 2019 07:30:14 -0800 |
parents | 313e3a279828 |
children | 9f70512ae2cf |
comparison
equal
deleted
inserted
replaced
43504:a78a65c33b5a | 43505:47fac1692ede |
---|---|
1107 elif not match.always(): | 1107 elif not match.always(): |
1108 # Matchers have yet to be implemented | 1108 # Matchers have yet to be implemented |
1109 use_rust = False | 1109 use_rust = False |
1110 | 1110 |
1111 if use_rust: | 1111 if use_rust: |
1112 # Force Rayon (Rust parallelism library) to respect the number of | |
1113 # workers. This is a temporary workaround until Rust code knows | |
1114 # how to read the config file. | |
1115 numcpus = self._ui.configint("worker", "numcpus") | |
1116 if numcpus is not None: | |
1117 encoding.environ.setdefault(b'RAYON_NUM_THREADS', b'%d' % numcpus) | |
1118 | |
1119 workers_enabled = self._ui.configbool("worker", "enabled", True) | |
1120 if not workers_enabled: | |
1121 encoding.environ[b"RAYON_NUM_THREADS"] = b"1" | |
1122 | |
1112 ( | 1123 ( |
1113 lookup, | 1124 lookup, |
1114 modified, | 1125 modified, |
1115 added, | 1126 added, |
1116 removed, | 1127 removed, |