Skip to content

tests: cache compiled cobolrt/CICS runtimes per worker and speed up closure/AST scans - #5247

Merged
squid-protocol merged 1 commit into
mainfrom
perf/test-suite-speedups
Oct 16, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
perf/test-suite-speedups

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Speeds up five high-leverage test bottlenecks (~1,990s of .test_durations CPU time across the suite) without changing or weakening any test assertion:

  1. tests/cobol_mainframe/test_det_nondigit_binary.py (_det, called 311x by test_det_nondigit_zoned.py)
    • Pre-compiles the unchanging cobolrt/*.java + CobolRecords.java runtime classes once per worker process (_runtime_classes()) and passes -cp <rt_classes> to javac/java so each test only compiles its generated service and Main.java (~3.2s -> ~0.55s per test across 311 cases).
  2. tests/cics_crucible/test_cics_runtimes.py (_stub and _cics_task, 206 tests / 548.8s)
    • Pre-compiles tests/equivalence/cics/ggcics.c once per worker to ggcics.o (_stub_obj()) and caches linked C stub binaries by main source (_compiled_stub()).
    • Pre-compiles CicsTask.java + CicsSpec.java once per worker (_cics_task_classes()) while still writing CicsTask.java to tmp_path/src/t/cics/ for source-inspection assertions, compiling only Main.java per test.
  3. tests/cobol_mainframe/test_det_programs.py (_java_run and _java_run_batch)
    • Pre-compiles the standalone and batch cobolrt + CobolRecords runtime classes once per (batch, charset) per worker (_runtime_classes()), speeding up test_det_programs.py, test_lifted_binary_trunc.py, test_trunc_opt.py, and 7 sibling modules (test_all_literal_relation_emits_compilable_java drops from 13.33s -> 1.92s; test_trunc_opt.py + test_lifted_binary_trunc.py drop from 172.4s -> 19.4s).
  4. tests/tools/test_ground_truth_plan.py (_closure)
    • Tokenizes each file once with re.compile(r"\w+").findall(...) and intersects with mods.keys() instead of running 120 separate re.search(rf"\b{re.escape(m)}\b", text) scans per file (13.97s -> 0.13s, 107x faster).
  5. tests/cobol_mainframe/test_java_subprocess_utf8.py (_java_calls and _maven_calls)
    • Skips ast.parse(source) on files that do not contain "subprocess" / ".tool" + "java" (or "subprocess" + "mvn"), cutting the 600-file AST scan from 3.71s -> 1.11s locally (19.73s -> ~2s on CI).

Verification

  • tests/tools/box/heavy-run.sh python tests/tools/pr_gates.py --fast (6/6 gates pass)
  • pytest tests/tools/test_ground_truth_plan.py tests/cobol_mainframe/test_java_subprocess_utf8.py tests/cobol_mainframe/test_trunc_opt.py tests/cobol_mainframe/test_lifted_binary_trunc.py tests/cobol_mainframe/test_det_programs.py tests/cobol_mainframe/test_det_nondigit_binary.py

@squid-protocol
squid-protocol marked this pull request as ready for review October 16, 2026 11:19
@squid-protocol
squid-protocol merged commit f2d4efd into main Oct 16, 2026
44 checks passed
@squid-protocol
squid-protocol deleted the perf/test-suite-speedups branch October 16, 2026 11:50
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