[PATCH 1 of 5 STABLE] rust-threads: force Rayon to respect the worker count in config

Raphaël Gomès raphael.gomes at octobus.net
Thu Dec 12 12:32:37 EST 2019


I'm abandoning this mail series because it was confusing, as the old 
Phabricator revisions are still there. I will re-send through Phabricator.

On 12/12/19 5:46 PM, Raphaël Gomès wrote:
> # HG changeset patch
> # User Raphaël Gomès <rgomes at octobus.net>
> # Date 1573399814 28800
> #      Sun Nov 10 07:30:14 2019 -0800
> # Branch stable
> # Node ID 36425b06e091f8e6336358dba278ef3804e183fb
> # Parent  612b4b63fb2267320f18655c0fa8a675f8fe3939
> 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
>
> diff -r 612b4b63fb22 -r 36425b06e091 mercurial/dirstate.py
> --- 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,
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list