Skip to content

v0.9.3 — performance diagnostics (--detailed + --bench)

Choose a tag to compare

@prostomarkeloff prostomarkeloff released this 08 Jun 12:37
· 37 commits to main since this release
a7f1c8e

Two opt-in, CLI-runner-only performance reports (rendered by the warm daemon — no native-pytest controller cost). Everything they report is a deterministic function of measured numbers and a fixed rule, never a heuristic guess. Each worker now also records its CPU time and inter-test bus idle, so the run rectangle decomposes exactly and per-test CPU-vs-I/O is known.

--detailed — why wasn't it faster, and should I add workers?

Extends the par. summary with: parallel efficiency vs the work-conserving ideal; CPU-vs-I/O split with idle core-equivalents (process CPU is low when blocked on a DB → I/O-bound while par. looks full); lost time in absolute worker-seconds (bus vs straggler tail); a balance read (a big test-count spread at near-equal walls is healthy); the duration floor/tail; and a verdict with a deterministic worker-count suggestion — cores / cpu_sat (Little's-law pool sizing), capped by an E-core discount (workers past the perf cores run on slower E-cores and only hide I/O). Always says measure — a shared resource or the E-core tax can cancel the gain.

--bench[=N] — what should I optimize?

Runs the suite N times (default 2; first dropped as warmup), then a targeted cProfile pass over just the top bottleneck tests adds function-level attribution. Ranked by reclaimable worker-seconds:

  • best @ cores — the deterministic ceiling max(Σwork/cores, longest-test).
  • SHARED SETUP clusters — (K−1)·S reclaimable if a fixture is session/module-scopeable (flagged [potential]).
  • per-test hot-spots — slowest calls classified I/O-/CPU-/SETUP-bound; the tip states only what the timings determine.
  • profile rows — top leaves by self time with exact call counts. 667× psycopg2.execute in one test is a measured N+1 / hot-call signal, not a guess. cProfile is stdlib (no dependency); overhead is paid only on the few tests that hold the wall.
  • unstable timing — with ≥2 measured runs, per-test coefficient of variation flags flaky/contended timings.

Also

  • New env vars PYTEST_FAST_WATCH_POLL / PYTEST_FAST_WATCH_DEBOUNCE (watcher reactivity tuning).
  • The project's own test suite went ~18s → ~8s serial / <3s parallel (found with --bench itself).
  • Pure-Python, no new dependency. README documents both reports.

Full changelog: v0.9.0...v0.9.3