1. Bad performance of code under coverage measurement#
Multiple projects report an increased overhead of coverage measurement
under python >= 3.12
, resulting in up to 50% longer CI pipelines.
This is the result of a performance regression that is not fixed as of python 3.12.9
,
see
Issue python/cpython #107674
Issue python/cpython #127953
A possible solution is using a new mechanism of python >=3.12
,
that is experimentally supported in coverage.py
to measure coverage
using sys.monitoring
instead of sys.setrace
.
To enable this option in your test suite, set the following environment variable in your CI pipeline:
COVERAGE_CORE=sysmon
Note that this option might actually result in a performance decrease in case branch coverage is enabled.
See e.g. this ctapipe pull request
More information on this can be found here: