Skip to content

docs(timings): the unit-test + import-time bottleneck census (epic phase 9) - #214

Merged
Jammy2211 merged 1 commit into
mainfrom
claude/ci-test-timing-epic-ke2lul
Sep 6, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
claude/ci-test-timing-epic-ke2lul

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Closes #213. Phase 9 of the ci-timing-fast-tests epic (PyAutoMind draft/feature/pyautoheart/ci_timing_fast_tests_epic.md) — the research verdict that closes the epic. One document, timings/unit_import_census_2026-09.md, beside the legacy digest; no library source, test or workflow changed anywhere.

Sources

CI truth for three repos from the first ingested unit-timings-<py> artifacts (the phase-8c PR runs): PyAutoNerves run 34038040174, PyAutoArray run 34039841741, PyAutoFit run 34039848597, both Python legs each; origin/main (2825c03, the heart-health run that ingested them) is merged in so the record and the document sit together. PyAutoGalaxy and PyAutoLens have no rows yet; every number for them is labelled local (one 4-core container, warm, serial --durations=0). Epoch fast-tests @ 2026-09-06.

The seven findings

  1. Compilation, not tests, is the largest term in library CI. Ten of PyAutoArray's 25 slowest CI tests cost 24.8 s in CI and ≤ 0.02 s locally — cold numba. lib-tests.yml restores no JAX cache and no numba cache; smoke-tests.yml has restored both since phase 7. Local A/B with a persistent JAX cache: PyAutoArray 43 s → 21 s.
  2. Coverage is a third of the legs at identical pass counts: PyAutoArray 45 → 60 s, PyAutoFit 71.5 → 120 s.
  3. One PyAutoGalaxy test is 52 % of its suite (17.84 of 34.3 s): kaplinghat.py:217 _density_3d_from_radius called 2,186,457 times from the scalar quad lambda at :258-263, for three grid points.
  4. Three imports paid and not needed at import, each traced to its line: matplotlib.pyplot 0.239 s via autolens/potential_correction/visualize.py:19; scipy.special 0.150 s via the module-level literal autofit/messages/normal.py:678; scipy.integrate 0.178 s via kaplinghat.py:5. A board round is 494 script processes, 232 importing autolens.
  5. PyAutoFit cannot run under -n auto: parametrized ids embed a memory address (test_prior_properties.py:63). The largest leg on the board is the only unparallelisable one.
  6. The interferometer "numpy" NUFFT is JAX (transformer.py:345): 3.49 s of a 4.84 s numpy-parity test is backend_compile_and_load; the no JAX in unit tests rule is breached by the library, not the tests.
  7. Fixture cost is not a finding anywhere; model.info/replace_promise and should_simulate are confirmed fixed from the third side; 7 blackjax tests are 33.6 s of PyAutoFit's 157.5 s leg and invisible locally.

Ranked options (§6, each with impact, risk, validation route and guard)

O1 caches for lib-tests.yml · O2 defer scipy.special out of import autofit · O3 defer pyplot out of import autolens · O4 vectorise the kaplinghat quadrature · O5 fix PyAutoFit's parametrized ids · O6 the --cov policy question · O7 the NUFFT NumPy path (documentation half recommended) · O8 the 400,000-step scaler test · O9 the blackjax lane (settings only). §7 lists what the compile-time verdict excludes; §8 the gaps (no CI rows yet for Galaxy/Lens, blackjax absent locally, the ~1.8× CI/local factor on three repos only, no option trialled end-to-end).

Each option the human accepts is filed as its own PyAutoMind prompt; nothing here changes source.

Test Plan

  • heart-tests.yml unaffected (docs-only change under timings/)
  • The PR's own run

🤖 Generated with Claude Code

https://claude.ai/code/session_0151gQm9fk3XGLi5f18Urdba


Generated by Claude Code

…ase 9)

The unit/import half the legacy round left as a placeholder, beside it in
`timings/`. A research verdict: no library source, test or workflow changed.

CI truth for PyAutoNerves / PyAutoArray / PyAutoFit from the first ingested
`unit-timings-<py>` artifacts (runs 34038040174, 34039841741, 34039848597);
PyAutoGalaxy and PyAutoLens are labelled local throughout, because their first
artifact is not ingested yet.

What it found, each cited by run id or by a profile:

- Ten PyAutoArray tests cost 24.8 s in CI and <=0.02 s locally: cold numba
  compilation, because `lib-tests.yml` restores none of the caches
  `smoke-tests.yml` already has. A local A/B with a persistent JAX compile
  cache takes the same suite 43 s -> 21 s.
- `pytest --cov` costs +33 % (PyAutoArray) and +68 % (PyAutoFit) locally at
  identical pass counts.
- One PyAutoGalaxy test is 52 % of that suite: `kaplinghat.py:217` called
  2 186 457 times from the scalar `quad` lambda at `:258`.
- Three imports are paid and not needed at import, each with its trigger line:
  `matplotlib.pyplot` 0.239 s via `potential_correction/visualize.py:19`,
  `scipy.special` 0.150 s via the module-level literal at
  `messages/normal.py:678`, `scipy.integrate` 0.178 s via `kaplinghat.py:5`
  — times 494 script processes a board round.
- PyAutoFit cannot run under `-n auto` at all: parametrized ids embed a memory
  address (`test_prior_properties.py:63`).
- Fixture cost is not a finding anywhere; `model.info` and `should_simulate`
  are confirmed fixed from the third side.

Nine ranked options with impact, risk, validation route and the guard each must
respect, and an explicit exclusion list: nothing that restructures a likelihood
or a sampler for compile time, nothing upstream-JAX-bound, and the standing
`no JAX in unit tests` rule kept.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151gQm9fk3XGLi5f18Urdba
@Jammy2211
Jammy2211 merged commit 20eea5b into main Sep 6, 2026
2 checks passed
@Jammy2211
Jammy2211 deleted the claude/ci-test-timing-epic-ke2lul branch September 6, 2026 16:15
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.

research: unit-test + import-time bottleneck census and shared-source hot-spot options (epic phase 9)

2 participants