Repository navigation
Run CodSpeed benchmarks on Python 3.14 and loop the smallest ones - #1498
Conversation
Disable cyclic GC while a benchmark runs: with GC enabled, whether a collection lands inside the single measured call, and which generation it collects, depends on allocation counts left by earlier tests. A full collection there moved test_create_multidict_with_many_items[cs-py] by 61% between otherwise identical runs. Loop the repr() and view inequality benchmarks 100 times; at a few tens of thousands of instructions per call, one allocator event was enough to move them by 6-7%. Run the benchmark job on Python 3.15.
|
This comment has been minimized.
This comment has been minimized.
Merging this PR will degrade performance by 78.13%
|
pytest-codspeed already runs gc.collect() and disables GC around each measurement, so the fixture was redundant.
|
@aiolibsbot rr |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
3.15 has no prebuilt setup-python build yet, so the job spent minutes compiling CPython; with 3.14 the original 10-minute timeout is enough.
PR Review — Run CodSpeed benchmarks on Python 3.14 and loop the smallest onesMerge-ready: a tight 17-line diff with all earlier review churn correctly cleaned up. Three non-blocking notes. Specific things done well:
What needs attention (all suggestions):
No correctness, security, or dual-backend concerns: the diff touches only benchmark bodies and one CI version, and 3.14 is already the top of the test matrix. 🟢 Suggestions
1. 3.14 leg has no visible green benchmark run yet; consider quoting the version
|
Rebase with requested adjustmentsBranch Changes applied
Not changed (and why)
StatsActions performed
CI statusCI will be checked asynchronously. Automated by Kōan |
The job takes about 9.5 minutes on 3.14, too close to the 10-minute cap.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1498 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 37 37
Lines 6021 6075 +54
Branches 538 544 +6
=========================================
+ Hits 6021 6075 +54
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What do these changes do?
Moves the CodSpeed benchmark job to Python 3.14, and makes the
repr()and view inequality benchmarks repeat their operation 100 times, the way the other benchmarks already loop. The benchmark job timeout goes from 10 to 15 minutes, since the job takes about 9.5 minutes.The high "variability" figures on the CodSpeed dashboard (up to about 140%) come from benchmark redefinitions in #1494 and from the real
add()andgetall()performance changes in #1466 and #1484, not from run-to-run noise. A same-commit rerun on master (242e5bd) reported 266 of 266 benchmarks unchanged. The dashboard window will age out by itself.Are there changes in behavior for the user?
No, only benchmarks and CI change. The reshaped benchmarks, and the move to 3.14, will cause a one-time jump in their CodSpeed history.
Is it a substantial burden for the maintainers to support this?
No.
Related issue number
N/A
Checklist
CONTRIBUTORS.txt: N/ACHANGES/foldermake doc-spellingpasses and any new technical words are added todocs/spelling_wordlist.txtAgent run details (optional, for reviewers)
Measurement: valgrind is not available locally, so a small pytest plugin emulated pytest-codspeed's simulation mode, including the
gc.collect()/gc.disable()andrandom.seed(0)thatplugin._measuredoes, followed by one warmup call and one measured call. It recorded user-space retired instructions withperf_event_open, pinned to P-cores. Each run allocated a different number of dummy objects first, to mimic unrelated heap changes between commits. The suite ran on CPython 3.15.0rc2 withPYTHONHASHSEED=0, 40 runs per variant, using the same seeds for both.test_items_view_not_equals[ci-py], followed bytest_values_view_repr[ci-c]at 2.4%.An earlier revision also added a
gc_disabledfixture, based on a harness that did not replicate pytest-codspeed's own GC handling. It was redundant and has been removed.Tests (3.14.2):
pytestpassed (2059 passed, 21 skipped);pytest --no-c-extensionspassed (1037 passed);pytest --codspeed --codspeed-mode simulationpassed (269 benchmarks). 3.15 was tried first but dropped: setup-python has no prebuilt 3.15 yet, so the job compiled CPython and ran even longer.Lint:
pre-commit runon the changed files passed;make doc-spellingpassed.Drafted with Claude Code (Opus 5); reviewed by asvetlov.