X Tutup
The Wayback Machine - https://web.archive.org/web/20260215140651/https://github.com/python/cpython/pull/1342
Skip to content

[WIP] bpo-30198: distutils: call os.stat() in serial#1342

Closed
vstinner wants to merge 1 commit intopython:masterfrom
vstinner:test_extension
Closed

[WIP] bpo-30198: distutils: call os.stat() in serial#1342
vstinner wants to merge 1 commit intopython:masterfrom
vstinner:test_extension

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Apr 28, 2017

Modify the build_ext of distutils to call newer_group() in serial
mode even if the parallel mode is used, instead of calling
newer_group() in threads, to avoid a slowdown caused by the GIL on
os.stat().

Benchmark with 4 logical CPUs (2 physical cores)
on "./python -E ./setup.py build":

+-----------+----------+-----------------------------+
| Benchmark | ref      | patch                       |
+===========+==========+=============================+
| -j4       | 1.06 sec | 576 ms: 1.84x faster (-46%) |
+-----------+----------+-----------------------------+
| -j16      | 1.01 sec | 583 ms: 1.73x faster (-42%) |
+-----------+----------+-----------------------------+

Serial (no -j option): no change (575 ms).

Modify the build_ext of distutils to call newer_group() in serial
mode even if the parallel mode is used, instead of calling
newer_group() in threads, to avoid a slowdown caused by the GIL on
os.stat().

Benchmark with 4 logical CPUs (2 physical cores)
on "./python -E ./setup.py build":

+-----------+----------+-----------------------------+
| Benchmark | ref      | patch                       |
+===========+==========+=============================+
| -j4       | 1.06 sec | 576 ms: 1.84x faster (-46%) |
+-----------+----------+-----------------------------+
| -j16      | 1.01 sec | 583 ms: 1.73x faster (-42%) |
+-----------+----------+-----------------------------+

Serial (no -j option): no change (575 ms).
@vstinner vstinner added the performance Performance or resource usage label Apr 28, 2017
@mention-bot
Copy link

@Haypo, thanks for your PR! By analyzing the history of the files in this pull request, we identified @collinw, @tiran and @freddrake to be potential reviewers.

@vstinner
Copy link
Member Author

The patch is a first draft to discuss the change, it must be polished to not break the API.

@vstinner vstinner changed the title bpo-30198: distutils: call os.stat() in serial [WIP] bpo-30198: distutils: call os.stat() in serial Apr 28, 2017
@vstinner vstinner closed this Jun 15, 2017
@vstinner vstinner deleted the test_extension branch June 15, 2017 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Performance or resource usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

X Tutup