From d9b2de7ce9161f902a6b6145d9d60a8d492d4959 Mon Sep 17 00:00:00 2001 From: Marco Heinemann Date: Mon, 22 Jan 2024 09:32:25 +0100 Subject: [PATCH] Fix typo --- doc/usage/configuration.rst | 2 +- sphinx/testing/fixtures.py | 2 ++ sphinx/testing/util.py | 4 ++-- sphinx/util/parallel.py | 2 +- tox.ini | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/usage/configuration.rst b/doc/usage/configuration.rst index 8d93805f49e..b66d0553be3 100644 --- a/doc/usage/configuration.rst +++ b/doc/usage/configuration.rst @@ -795,7 +795,7 @@ General configuration the parallel write phase. When active, the event :event:`doctree-resolved` as well as the builder function ``write_doc_serialized`` also run in parallel. Parallel post-transformation can greatly improve build time for extensions that - do heave computation in that phase. Depending on machine core count and project + do heavy computation in that phase. Depending on machine core count and project size, a build time reduction by a factor of 2 to 4 and even more was observed. The feature flag does nothing in case parallel writing is not used. diff --git a/sphinx/testing/fixtures.py b/sphinx/testing/fixtures.py index a62f34694b7..c6d4fbb7c31 100644 --- a/sphinx/testing/fixtures.py +++ b/sphinx/testing/fixtures.py @@ -145,6 +145,7 @@ def app( """ args, kwargs = app_params app_ = make_app(*args, **kwargs) + app_.env.config.enable_parallel_post_transform = True yield app_ print('# testroot:', kwargs.get('testroot', 'root')) @@ -189,6 +190,7 @@ def make(*args: Any, **kwargs: Any) -> SphinxTestApp: kwargs.setdefault('status', status) kwargs.setdefault('warning', warning) app_: Any = SphinxTestApp(*args, **kwargs) + # app_.env.config.enable_parallel_post_transform = True apps.append(app_) if test_params['shared_result']: app_ = SphinxTestAppWrapperForSkipBuilding(app_) diff --git a/sphinx/testing/util.py b/sphinx/testing/util.py index e15a43b4b33..c81f8274532 100644 --- a/sphinx/testing/util.py +++ b/sphinx/testing/util.py @@ -91,8 +91,8 @@ def __init__( status: IO | None = None, warning: IO | None = None, tags: list[str] | None = None, - docutils_conf: str | None = None, - parallel: int = 0, + docutilsconf: str | None = None, + parallel: int = 4, ) -> None: assert srcdir is not None diff --git a/sphinx/util/parallel.py b/sphinx/util/parallel.py index 10f8c8945af..6b8ce39997d 100644 --- a/sphinx/util/parallel.py +++ b/sphinx/util/parallel.py @@ -149,7 +149,7 @@ def make_chunks(arguments: Sequence[str], nproc: int, maxbatch: int = 10) -> lis chunksize = nargs // nproc if chunksize >= maxbatch: # try to improve batch size vs. number of batches - chunksize = int(sqrt(nargs / nproc * maxbatch)) + chunksize = int(sqrt(sqrt(nargs / nproc * maxbatch))) if chunksize == 0: chunksize = 1 nchunks, rest = divmod(nargs, chunksize) diff --git a/tox.ini b/tox.ini index fb7e344ff0b..28632ae6508 100644 --- a/tox.ini +++ b/tox.ini @@ -24,7 +24,7 @@ setenv = PYTHONWARNINGS = error PYTEST_ADDOPTS = {env:PYTEST_ADDOPTS:} --color yes commands= - python -X dev -X warn_default_encoding -m pytest --durations 25 {posargs} + python -X dev -X warn_default_encoding -m pytest -n 4 --durations 25 {posargs} [testenv:docs] basepython = python3