Repository navigation
Conversation
Outlines parsed with ClassFile.outline no longer copy every field, method, and annotation into growing ArrayLists when the outline is created. Members are adapted on first request into exact-size arrays wrapped by ByteBuddy's Explicit lists, and the same immutable lists are returned on every call. Racing first requests each build equal, immutable members and one is published through a volatile field; no locking. Outlines built one member at a time (visitor and loaded-class parsing) are unchanged, except that their lists are created on first declaration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
This branch has not been deployed
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.
What Does This Do
Outlines parsed with
ClassFile.outlineno longer copy every field, method, and annotation into theTypeOutlineup front. Members are adapted on first request, into exact-size arrays wrapped by ByteBuddy'sExplicitlists (no copy), and the same immutable lists are returned on every call.volatilefield. The pending outline is cleared only after the members are published, so a thread never sees neither.TypeOutlineTest(JUnit 5): adapted members match an independent ASM read of the same class (fields, methods, method and class annotations of interest); a type without members; repeated calls return the same lists; 16 threads racing the first access agree over 50 rounds.Motivation
TypeOutline(ClassOutline)wrapped every member eagerly into default-sized, growingArrayLists for every outlined type.Measured on PetClinic startup, two agent builds from the same base commit:
The gain is modest because laziness rarely gets to skip work today: 94% of outlined types (5,640 of 6,015) still have all their members adapted.
Memoizer.doMemoizeevaluates every registered field and method matcher against every declared member of every memoized type, including the whole supertype hierarchy. Most of this PR's saving comes from exact-size arrays replacing growing lists.Data for a follow-up: member matching is almost all misses
Measured in the same PetClinic startup with a temporary counter build:
declaredBy(the same for every member of a type, so they can be checked once per type)Each startup builds about 84,000 ByteBuddy member objects and makes about 1.6 million matcher calls to find a few dozen members that matter. A prefilter in the memoizer (check member names against the 13 field and 11 method names matchers can match, check whether a method has any annotation of interest, and evaluate
declaredByonce per type) would skip nearly all of that, using dataClassFile.outlinealready provides. I'd like to discuss that direction before proposing it; this PR is the uncontroversial first step.Additional Notes
spotlessApply; the outline tests pass, includingOutlineTypeParserTest,TypeFactoryTargetBytecodeTest, andTypeFactoryForkedTest.🤖 Generated with Claude Code