Repository navigation
perf: compress embedded JDK constructor bundle and trim internal omap for v0.8.1 - #33
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two binary-size optimizations targeting consumers embedding
github.com/yaklang/javajive(includingyakfull & slim builds):Deterministic chunked-Zstd JDK constructor bundle (
-9.40 MiBembedded data)classparser/jdk_constructor_code.zip(17,909,526 B / 17.08 MiB) on disk as the source of truth (matching perf: compress embedded JDK metadata for v0.8.0 #32's pattern forjdk_metadata_catalog.json).tools/compressjdkwith-constructor-zip(wired intogo generate ./classparser) to pack all 9,816 JDK 8/9/11/16/17/21 classfiles sorted by(className, release)into 1 MiB chunks compressed with deterministic Zstd (SpeedBestCompression, concurrency 1, CRC enabled) intoclassparser/jdk_constructor_code.bundle.zst(8,048,188 B / 7.68 MiB, -55.1%).classparser/jdk_constructor_code.goto embed onlyjdk_constructor_code.bundle.zst, lazily decode only the manifest on first JDK candidate lookup, lazily decompress each 1 MiB chunk at most once via per-chunksync.Once(zero mutex contention), verify per-class SHA-256 on every lookup, and return an owned copy.TestJDKCompressedConstructorCodeMatchesSourceverifying profile counts and byte-for-byte equality across all 9,816 classes againstjdk_constructor_code.zip, and register it intools/requiredci/main.go.Trim dead generic methods from
internal/omap(-40+unused methods)SearchGlobKey,SearchRegexKey,MarshalJSON,UnmarshalJSON,ValuesMap,WalkMap,OrderInsert,Filter,Flat,Merge, etc.) and dead helper files from the privateinternal/omappackage, keeping only the 10 methods used byjavajive.defer o.lock.Unlock()/defer o.lock.RUnlock()with explicit unlocks to avoid generating.deferwrap1closures per generic shape.reflect.MethodByName) from retaining ~1,200+ unused generic wrapper functions (~1 MiB).Bump
Versionto0.8.1.Validation
go generate ./classparserproduces byte-identical SHA-256 for bothjdk_constructor_code.bundle.zstandjdk_metadata_catalog.json.zst.go vet ./classparser ./tools/compressjdk ./tools/requiredci ./internal/omap .passes cleanly.go test -race ./classparser -run '^(TestJDKCompressedConstructorCodeMatchesSource|TestAdversarialPlatformConstructorCodeIdentityAndEffectProof|TestAdversarialPlatformInterfaceDeclarationsUsePinnedOriginalFlags|TestJDKCompressedCatalogMatchesSource)$'passes.go run ./tools/requiredci -check,-run corpus, and-run algorithmall pass.go test ./classparser/decompiler/rewriter/... ./internal/filesys/... ./tools/requiredci/...passes.