Set COVERAGE_CORE: sysmon for faster tests on 3.12+#7820
Set COVERAGE_CORE: sysmon for faster tests on 3.12+#7820hugovk merged 1 commit intopython-pillow:mainfrom
COVERAGE_CORE: sysmon for faster tests on 3.12+#7820Conversation
Is the reason it's not yet the default, and why https://coverage.readthedocs.io/en/7.4.2/changes.html#version-7-4-0-2023-12-27 lists it as "experimental", just because branch coverage isn't faster? Or is there another reason? |
|
Yeah, I think it's both because of branch coverage, and because it's new and using new Python features, so feedback is requested. If we find any problems, we can give feedback, and easily disable if necessary. |
radarhere
left a comment
There was a problem hiding this comment.
I see that it is faster on AppVeyor, macOS and Ubuntu.
I find it harder to say conclusively that it is faster in Windows on GitHub Actions, but if it is theoretically, then ok.
|
Here's three runs of Windows on GitHub Actions with https://github.com/hugovk/Pillow/actions/runs/7941332092/attempts/1 Then with the PR: https://github.com/hugovk/Pillow/actions/runs/7986985726/attempts/1 |
|
Despite passing on main a mere 11 hours ago, this has started failing in PyPy on Windows - https://github.com/python-pillow/Pillow/actions/runs/8016398970/job/21898259794 |
Python 3.12 introduced sys.monitoring, that tools like coverage.py can use to improve performance.
It's not yet the default in coverage.py. To enable, we can set a
COVERAGE_CORE=sysmonenvironment variable, that will switch to the faster mode when available, that is, in Python 3.12 and newer. Older versions will stick to the older method.For example, on my machine:
python3 -m pytest Testspython3 -m pytest --cov PIL --cov Tests TestsCOVERAGE_CORE=sysmon python3 -m pytest --cov PIL --cov Tests TestsCoverage time on CI, default core -> sysmon core:
I also added the env var to the Cygwin and MinGW workflows, even though they test Python <= 3.11. If they're upgraded to 3.12+ later, it'll take effect.