Skip to content

Tooling: 1.27x faster t16 invoice-boundary replay via compresslevel=1 (identical receipt) - #3009

Merged
Mister-Meeseeks merged 1 commit into
CrocSwap:mainfrom
kumagi:research/t16-compresslevel
Oct 16, 2026
Merged

Mister-Meeseeks merged 1 commit into
CrocSwap:mainfrom
kumagi:research/t16-compresslevel

Conversation

@kumagi

@kumagi kumagi commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

registered t16 replay writes 31 mutated .gz fixtures at zlib level 9
  -> zlib.compress was 24.7 s of a 96.1 s profile
  -> compresslevel=1, decompressed payloads unchanged, receipt byte-identical

One-line tooling change to research/t16-invoice-boundary-audit/verify.py: gzip.compress(data, mtime=0) becomes gzip.compress(data, mtime=0, compresslevel=1). Same-fixture measurements, direct registered command, stdout byte-identical on every interpreter:

interpreter before after speedup stdout
CPython 3.11.15 174.19 s 149.51 s 1.17x identical
CPython 3.12.13 107.41 s 84.40 s 1.27x identical
CPython 3.14.4 67.72 s 43.90 s 1.54x identical

The verifier's own receipt comparison passes unchanged (PASS_T16_INVOICE_BOUNDARY_AUDIT {"assembly": {"ACCEPTED": 10, "REJECTED": 16}, "cases": 54, "invoice": {"ACCEPTED": 26, "REJECTED": 28}}), and python3.12 scripts/research_package.py --package research/t16-invoice-boundary-audit ends PASS_REGISTERED_RESEARCH_PACKAGE ... outcome=completed. No input, fixture, case, control or receipt byte changes; only the compression level of freshly written work-directory fixtures.

Reviewer checklist

  • scripts/check_research_commit.py --package research/t16-invoice-boundary-audit -> PASS_RESEARCH_COMMIT_BYTES (16 files at 95568ae8).
  • scripts/research_package.py --package ... --check-only -> PASS_PACKAGE_METADATA_AND_PINS.
  • git diff HEAD~1 --check clean (no whitespace errors).
  • Direct replay passes on 3.11.15, 3.12.13 and 3.14.4 with identical stdout.
  • Registered replay passes on 3.12.13 through the generic runner.
  • Hosted CI: the Registered research packages run (38939671806) is still queued; I will fix any failure it reports.

Evidence

  • Profile (cProfile, CPython 3.14.4): zlib.compress 24.7 s / 31 calls, json.raw_decode 10.8 s / 1,968 calls, vendored invoice_allcold.recount_provider 40.7 s cumulative / 52 calls, fractions ~20 s cumulative.
  • This patch removes only the first item. The vendored engine is untouched; the remaining raw_decode cost needs the author's decision (a parsed-source cache across cases would have to respect the per-case mutation writes).
  • Byte-identity policy: the repository already compares decompressed payloads rather than container bytes across Python/zlib versions (community reproducibility audit), so the level change does not alter any proof-relevant content.
  • The package does not self-pin its own verify.py bytes (no MANIFEST/PINS self-check).

Merge danger

Door: two-way. One line, removable without changing any supplier, receipt or claim. Blast radius: isolated to this package's registered replay runtime.

Convention check: many tooling PRs add a separate research/*-fast-* package, but direct patches to an existing package verifier with an identical receipt are also merged precedent - e.g. #2357 modifies research/complex-center-quarter/verify.py (with re-pinning), #2409 modifies vendored audit code and manifests, and #2100 modifies scripts/experiments/ternary_side.py. This package does not self-pin its own verify.py bytes, so no manifest update is needed. If the maintainers prefer the package form here, I can repackage the same measurement instead.

Credit: Tairitsu-Aya for the package and its 54-case mutation design. Prepared by @kumagi with substantial AI assistance (DeepSeek V4.1 Flash in the OpenCode harness). Apache-2.0.

The registered replay wrote every mutated .gz fixture at zlib's default
level 9; zlib.compress alone was 24.7 s of the 96.1 s cProfile total.
compresslevel=1 leaves the decompressed payloads unchanged, so the full
deterministic receipt is byte-identical: CPython 3.12.13 direct run
107.41 s -> 84.40 s with identical stdout, and 3.14.4 67.72 s -> 43.90 s.
No mathematical, source or receipt change.
@kumagi

kumagi commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

Review-readiness update (no code change since head 95568ae8):

@Mister-Meeseeks
Mister-Meeseeks merged commit 6837fa6 into CrocSwap:main Oct 16, 2026
1 check 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.

2 participants