Skip to content

ci(coverage): use the sysmon tracing core to speed up the coverage job - #919

Open
ddivyanshsharmaa wants to merge 2 commits into
petercorke:mainfrom
ddivyanshsharmaa:ci-coverage-sysmon
Open

ddivyanshsharmaa wants to merge 2 commits into
petercorke:mainfrom
ddivyanshsharmaa:ci-coverage-sysmon

Conversation

@ddivyanshsharmaa

Copy link
Copy Markdown

Refs #898.

What changes

Sets COVERAGE_CORE: sysmon for the "Run coverage" step in ci.yml. Python 3.12's sys.monitoring tracing core is lighter than the default core. Nothing else is touched, and branch coverage is not enabled in pyproject.toml, so the core's lack of branch support does not matter here.

Measurements

Full suite (2,402 tests, all passing) on ubuntu-latest, Python 3.12, run twice per variant:

Variant Coverage Lines covered / valid Test time, run 1 Test time, run 2
current (default core) 86.118% 13,958 / 16,208 721 s 1,486 s
COVERAGE_CORE=sysmon 86.118% 13,958 / 16,208 521 s 483 s

The covered line count is identical, so the Codecov number does not change. The runners varied by about 2x between runs, so the saving was roughly 30% to 65%; the second run's baseline matches the 25 minutes in the issue.

Not changed

  • The slow tests still run in this job. In the same experiment they added only 26 uniquely covered lines (0.16 points), but they run nowhere else in CI, so removing them from here would drop them entirely. That is your call.
  • Running the tests in parallel with pytest-xdist on top of sysmon made little difference in the second run (471 s against 483 s), so I left it out.
  • The other ideas in the issue (running coverage less often, more caching) are untouched.

On Python 3.12 the sysmon core counted exactly the same lines as the default
core (13958 of 16208, 86.118%) and cut the test time from 721 s to 521 s on one
run and from 1486 s to 483 s on another, on ubuntu-latest.

Refs petercorke#898
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@petercorke

Copy link
Copy Markdown
Owner

Thank you for your interest in RTB, and for measuring this so carefully. The checks have now run and the coverage job took about 10 minutes here, against 20 to 25 on recent main runs, so this is good to go from my side.

Before I merge: did an AI assistant help with the change? The PR template asks, and a sentence is enough.

@ddivyanshsharmaa

Copy link
Copy Markdown
Author

Yes, I used an AI assistant (Claude Code) to help run the timing experiments and draft the change and PR text. I reviewed the results and the diff myself before opening it, and the measurements are from real GitHub runners, so I'm happy to rerun or explain any of them.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants