Skip to content

Move the coordinator images and CI to Python 3.14 - #201

Merged
kiwidream merged 1 commit into
2.x.xfrom
move-images-and-ci-to-python-314
Aug 25, 2026
Merged

kiwidream merged 1 commit into
2.x.xfrom
move-images-and-ci-to-python-314

Conversation

@kiwidream

@kiwidream kiwidream commented Aug 21, 2026 •

Copy link
Copy Markdown
Member

Why

Closes #169.

Measured: this is a small regression, not a win

The rationale below originally claimed free performance on an interpreter-bound workload. That was
reasoning, not measurement, and it is wrong.
Measured with the repository's own instrument
(tests/perf/serialize_block_share_cost.py), four rounds with the interpreter order reversed so
warm-up bias cannot favour either side, min-of-samples:

template gcc 3.12 gcc 3.14 clang 3.14 + tail-call 3.14 vs 3.12 clang-TC vs 3.12
0 tx 7.27 µs 7.58 µs 6.89 µs +4.3% −5.2%
100 KB 11.94 12.86 12.38 +7.7% +3.7%
500 KB 13.22 13.89 13.66 +5.1% +3.3%
1 MB 13.73 14.76 14.39 +7.5% +4.8%
2 MB (ceiling) 14.24 15.40 14.99 +8.1% +5.3%

The comparison is fair: both official images are gcc, PGO, LTO, computed gotos.

Why 3.14 is slower here

No official 3.14 image has the tail-call interpreter. Checked all four variants — python:3.14,
-bookworm, -alpine, -slim — every one is gcc with Py_TAIL_CALL_INTERP = 0, and pyconfig.h
says #undef outright. 3.14's headline dispatch work requires clang 19+ with preserve_none, so
these images carry the release's costs without its main win.

A custom build recovers some of it, and is not worth owning

Built CPython 3.14.7 with clang-19, --with-tail-call-interp, PGO and LTO to match. The tail-call
interpreter does work on aarch64 (Py_TAIL_CALL_INTERP 1). It recovers 2–4 points, but is still
3–5% slower than 3.12 at every realistic template size.

The 0-tx row explains the shape: that case has the least C work, and there tail-call dispatch wins
5.2%. As template size grows and C-bound work (hex decode, hashing, join) dominates, the win
evaporates — so 3.14's regression here is evidently not in interpreter dispatch, since clang-TC
fixes that and still loses.

Against that, owning the image costs CPython security updates, a long PGO compile in CI, and two
packaging landmines already hit while building it (llvm-ar is only shipped suffixed; PGO needs
libclang-rt-19-dev). Not worth 2 points.

Why this still merges

The absolute magnitude is negligible. The accept path costs about 0.39% of a core at the
~273 shares/s design point, so a 5% regression on it is roughly 0.02% of a core.

So the case for 3.14 rests on the other reasons, which are unaffected: stdlib zstd (PEP 784) for
#158, a prerequisite for #150, and not sitting three feature releases behind. It does not rest on
speed, and this PR no longer claims it does.

Not measured: the window pipeline (~71 ms per materialization) is the real CPU consumer and was
not measured on 3.14. tests/perf/window_pipeline_gil_scaling.py is the instrument for it. A 5%
swing there is ~3.5 ms per re-anchor — still small, but it is the number that would change this
recommendation if it were much worse.


What changes

Eight pins. No code changes.

lab/prism/Dockerfile:3, lab/auxpow/Dockerfile:3, lab/miner-sim/Dockerfile:1 → python:3.14-slim-trixie
.github/workflows/ci.yml — four jobs (:23, :85, :109, :201) → python-version: "3.14"
docs/prism-coordinator-refactor/validation.md:83 the documented compileall command

#169 said seven pins; a fourth CI job has been added since it was filed. Its own comment explains
why it must move with the others — "this job needs the same interpreter the unit tests run under
rather than whatever the runner image happens to ship."

The Debian release is now pinned explicitly. The unsuffixed -slim tags track whatever Debian
is current, so today's agreement between 3.12-slim and 3.14-slim is luck rather than contract.
Without the suffix, a future rebuild silently becomes a distro bump that moves the apt Rust
toolchain under cargo build --locked --release -p qbit-prism — and this PR would be blamed for it.

Verification

Toolchain parity — the main stated risk in #169, measured on both bases:

3.12-slim         -> trixie | rustc 1.85.0+dfsg3-1 | psql-client 17+278
3.14-slim-trixie  -> trixie | rustc 1.85.0+dfsg3-1 | psql-client 17+278

Byte-identical, so no MSRV movement and the apt layer is unaffected.

Dependency: the coordinator image has exactly one third-party package, and psycopg-binary
ships cp314 wheels — so the 3.2.* pin does not need to move. Confirmed by installing and
importing psycopg 3.2.13 on Python 3.14.7 in the new base. Nothing in the tree imports a stdlib
module removed in 3.13 or 3.14.

Behaviour — full discovery in both containers, identical conditions:

3.12-slim 3.14-slim-trixie
tests 2,675 2,675
failures / errors 7 / 36 7 / 36

and the failing test-name sets diff clean — not just equal counts, the same 43 tests. Those 43
are environmental: the bare container has no make or git, so the Makefile-lifecycle,
source-staging and production-gate suites fail the same way on both interpreters.

compileall over docker lab tests examples scripts clean on the new base.

One consequence worth recording

This invalidates the absolute numbers in #143, #162 and #131 — all measured on 3.12, and now
known to move by roughly 5% on the accept path. The direction of every conclusion survives, but
figures quoted in those issue comments should be re-baselined rather than carried forward. tests/perf/ has the instruments (#160/#170/#192) to do
that as a comparison rather than a rebuild.

PRISM is interpreter-bound on the paths that matter. #162 established that
directly: once block serialization left the accept path, what remained was
16.5 us of pure interpreter work, flat across a 12,600x range of template
size. Interpreter version is therefore a first-order lever on this workload,
and the tree was two feature releases behind.

Eight pins move: three Dockerfiles, four CI jobs, and the documented
compileall validation command. No code changes.

The Debian release is now pinned explicitly rather than inherited. The
unsuffixed -slim tags track whatever Debian is current, so today's agreement
between 3.12-slim and 3.14-slim is luck rather than contract; without the
suffix a future rebuild silently becomes a distro bump that moves the apt
Rust toolchain under cargo build --locked. Verified both bases resolve
identically today: trixie, rustc 1.85.0+dfsg3-1, postgresql-client 17+278.

Compatibility was checked rather than assumed. The coordinator image has one
third-party dependency and psycopg-binary ships cp314 wheels, so the 3.2.*
pin does not move -- confirmed by installing and importing psycopg 3.2.13 on
3.14.7 in the new base. Nothing in the tree imports a stdlib module removed
in 3.13 or 3.14.

Behaviour is unchanged on the suite. Full discovery run in both containers
under identical conditions: 2,675 tests, 7 failures and 36 errors on each,
and the failing test-name sets diff clean. Those 43 are environmental -- the
bare container has no make or git, so the Makefile-lifecycle, source-staging
and production-gate suites fail the same way on both interpreters.

One consequence to record: this invalidates the absolute numbers in #143,
#162 and #131, which were all measured on 3.12. The direction of every
conclusion survives; the figures quoted in those issue comments should be
re-baselined rather than carried forward.

Closes #169.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@kiwidream
kiwidream merged commit c27a1f5 into 2.x.x Aug 25, 2026
11 checks passed
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.

1 participant