Skip to content

perf: reduce compiler scanning costs - #326

Draft
YunaBraska wants to merge 2 commits into
mainfrom
perf/compiler-throughput
Draft

YunaBraska wants to merge 2 commits into
mainfrom
perf/compiler-throughput

Conversation

@YunaBraska

@YunaBraska YunaBraska commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Changes

  • Replace boxed instruction-boundary sets with a method-local boolean table while retaining malformed-bytecode diagnostics.
  • Compare UTF-16 string regions with two independent cursors instead of repeatedly decoding both strings from the start.
  • Find exact throwable hierarchy keys without splitting and rescanning every table row. Keep one data source and remove the old comparison helper.
  • Cover Unicode/surrogate boundaries, malformed stack-map offsets, every declared throwable parent and partial/invalid lookup names. Share one native comparison build across 21 independently executed cases.

No dependencies, persistent caches, concurrency policy, public CLI behavior or supported-JDK accounting changes. Net production line count is unchanged.

Verification

  • 649 focused tests passed with the combined implementation. Full clean Maven verification succeeded: 7,212 tests, no failures/errors, three Windows-specific skips on macOS.
  • Independent diff review found no open correctness issues.
  • The 22-test UTF-16 suite runs in 3.93 seconds rather than 30.26 seconds after sharing fixture compilation, with GC stress enabled for the new cases.
  • Controlled whole-compiler measurements use identical frozen compiler classes, macOS ARM64, JDK 25.0.4, Apple Clang 21.0.0 and a 1 GiB managed heap.
  • Native self-check median: 366.24s -> 276.96s wall, 363.80s -> 276.74s CPU. Wall gain 24.4%, CPU gain 23.9%, peak RSS 5.05 -> 5.03 GiB.
  • Cold native self-build: 1095.82s -> 891.44s wall, 1094.77s -> 890.49s CPU. Gain 18.7%, 204s saved, peak RSS essentially unchanged at 7.54 -> 7.57 GiB. All 66 objects rebuilt. One cold pair, not a universal speed guarantee.
  • All compared diagnostics/control-flow/class-initialization reports are byte-identical. Generated application C is identical except the intentional runtime helper. Final checks followed retained baseline runs, not a final interleaved comparison. Full method and limitations: verification history.
  • All 22 UTF-16 tests also passed with LLVM AddressSanitizer, UndefinedBehaviorSanitizer and leak detection enabled.
  • Native generations 2 and 3 produced equal C. Archive, extracted doctor/help/version and five malformed-class boundary probes passed.
  • Full five-probe self-host sanitizer passed: 41,541,932 allocations, six GC collections, zero final live allocations/bytes/root frames, leak detection enabled.
  • Extracted-package acceptance finished: 114 checks executed and passed, six optional external-dependency probes skipped because their artifacts are not installed.
  • All eight sanitizer scopes completed: 81 runtime/library probes plus the full five-case self-host run. Every retained proof reports pass, leak detection enabled and no sanitizer failure signatures. Runtime scopes used a clean archive of the exact implementation commit, isolated from acceptance outputs.
  • Overall scoped Java coverage is 94.5% line / 83.6% branch. Advisory targets remain unmet. Generated C requires separate sanitizer evidence, not Java source-emission coverage.

Review And Remaining Risk

The complete diff was reviewed for parser boundaries, UTF-16/surrogate semantics, ownership, concurrency, preserved diagnostics, complexity and test isolation. No open correctness finding remains in the changed code. Production code has 37 added and 37 removed lines. The 121 net code additions are regression tests.

One native Clang invocation failed while preparing try-finally-exception, before its sanitizer run. The generated C was byte-identical to the already successful acceptance fixture and passed a direct Clang syntax check. An unchanged rebuild and a clean repeat of the entire 15-case exception sanitizer scope both passed. No crash report was found and the original invocation's underlying cause remains unknown. This observation is retained rather than hidden by the successful repeat.

Both the implementation commit and final head ba699452 passed CI, including Linux x64/ARM64 and macOS ARM64 package lanes. Final-head result: 30 successful checks, seven intentional workflow skips, no failures. The published diff matches the reviewed local changes, the branch is clean and pushed, and GitHub reports CLEAN against current main f028bf40. This PR remains a draft pending explicit merge approval. No new JDK/platform support or universal performance guarantee is claimed.

This branch has not been deployed

No deployments
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