Skip to content

tests: a javac that stays up for the det programs' tests (Mainframe Ground Truth -18%) - #5901

Merged
squid-protocol merged 1 commit into
mainfrom
ci/mgt-javac-server
Oct 21, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
ci/mgt-javac-server

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Mainframe Ground Truth is 17% of the CI pool's runner time (2026-10-21: ~3,800 of ~22,100 runner-min), and the pool is saturated (p90 job queue 25-31 min, 14-17 UTC).

Where its time goes

On run 39658216459, pytest is about 6.6 of each part's 8 min; setup is about 1 min. tests/cobol_mainframe/test_det_nondigit_zoned.py alone is 649 of 2,983 test-seconds (22%): 496 tests, each running a javac on a small translated program. A local measurement:

  • translate: 0.02 s
  • javac: 0.58 s (a JVM start; the compile itself is about 0.05 s warm)
  • java: 0.06 s

On a runner that's about 1.7 s a test.

Change

  • tests/tools/javac_server.py: the JDK's own compiler (javax.tools, what the javac launcher runs) in one JVM per process.
    • javac(argv, **kw) answers as subprocess.run(argv, **kw) does for the launcher: the return code, diagnostics on stderr (printed unless captured), check, and timeout.
    • The class files are byte-identical to the launcher's (tested).
    • Anything it can't answer the same way goes to the launcher: no -encoding (the launcher reads sources in the locale's charset), a relative path, its own cwd/env/streams, -J options, @argfiles, -version and the like, or a server that died twice.
    • GITGALAXY_JAVAC_SERVER=0 forces the launcher.
  • The programs still run in a fresh java process of their own.
  • test_det_nondigit_binary._det, which test_det_nondigit_zoned.py uses, compiles through it.

Measured (local)

test_det_nondigit_zoned.py + test_det_nondigit_binary.py: 264 s → 42 s (6.3×), 460 passed and 41 skipped both ways. Scaled to CI, that's about 550 of 2,983 test-seconds a run (about 18%), roughly 1.2 min off each part of a 2-part run.

Next (not here)

About 40 other test files call javac directly (about 394 test-seconds on CI, 13% more). They can switch to javac_server.javac one call site at a time.

Checks

  • tests/tools and the UTF-8 subprocess guard (test_java_subprocess_utf8.py): pass. The server's own java carries the UTF-8 flags, and only requests that state -encoding are served.
  • New tests/tools/test_javac_server.py: byte-identical classes, identical diagnostics and return code on a compile error, every launcher fallback, and a dead server replaced.
  • tests/ruff_audit.py --ci: no new findings.

🤖 Generated with Claude Code

…round Truth)

test_det_nondigit_zoned.py was 22% of Mainframe Ground Truth's test time (649 of
2983 test-seconds on run 39658216459): 496 tests, each a javac of a small program
(~0.6 s here, ~1.7 s on a runner -- a JVM start, then a ~0.05 s compile). Its _det
helper (test_det_nondigit_binary.py) now compiles through tests/tools/javac_server.py:
the JDK's own compiler (javax.tools) in one JVM per process, answering as
subprocess.run of the launcher does (return code, diagnostics on stderr, check,
timeout). Class files byte-identical to the launcher's. Anything it cannot answer the
same goes to the launcher: no -encoding, a relative path, its own cwd / env / streams,
-J options, @argfiles, -version and the like, a server that died twice.
GITGALAXY_JAVAC_SERVER=0: always the launcher. The programs still run in a java of
their own.

The two files, locally: 264 s -> 42 s (460 passed, 41 skipped, both ways).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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