Skip to content

perf: compress embedded JDK metadata for v0.8.0 - #32

Merged
VillanCh merged 1 commit into
mainfrom
codex/javajive-compact-jdk-data
Nov 13, 2026
Merged

VillanCh merged 1 commit into
mainfrom
codex/javajive-compact-jdk-data

Conversation

@VillanCh

@VillanCh VillanCh commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

The JDK invocation catalog was embedding 10.90 MiB of uncompressed JSON into every Javajive consumer. Embed a deterministic zstd asset instead and decode it only when the existing one-time catalog loader needs it. All supported JDK profiles, provenance checks, constructor classfiles, and offline behavior remain available.

The compressed catalog is 912,885 bytes (0.87 MiB), down from 11,428,730 bytes. A controlled Go 1.22.12 darwin/arm64 CLI build with -ldflags '-s -w' shrinks from 45,324,642 to 34,943,730 bytes: 9.90 MiB / 22.90% smaller, including the zstd decoder.

A five-run catalog-decoding benchmark on the same machine has a median of 87.1 ms for plain JSON and 93.4 ms for compressed JSON: about 6.3 ms extra on the first required catalog decode, plus 11.1 MiB of additional temporary allocations. The decoded metadata remains cached by the existing one-time loader; the extra JSON buffer is not retained.

Keep the reviewed JSON as regeneration input, add go generate ./classparser, and include a byte-for-byte compressed/source equality test in the required corpus gate. Existing metadata tests use the production decoder. The constructor ZIP stays unchanged. The codec dependency matches Yaklang's existing klauspost/compress v1.17.9.

Bump the library/CLI version to 0.8.0 for the release following universal-input PR #31.

Validation:

  • CGO_ENABLED=0 go build ./...
  • Required CI inventory check and all four local groups: contract, corpus, algorithm, dex.
  • JDK metadata, constructor, hierarchy, and indexed-platform tests, including every retained class's independent original hash checks.
  • Focused catalog/request-isolation tests with the race detector.
  • Re-running go generate ./classparser produces the identical SHA256.
  • CLI prints javajive 0.8.0; git diff --check passes.

The compressed asset saves executable disk space. This does not claim the same reduction for an already compressed distribution package or remove runtime JDK metadata.

@VillanCh
VillanCh merged commit d3d16c7 into main Nov 13, 2026
5 checks 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.

1 participant