Repository navigation
Conversation
MemberPattern is a single final matcher class for fields and methods: exact names, name sets, a leading or trailing '*', descriptor patterns where '?' stands for one whole parameter and a trailing '*' for the rest, access flags, and declared annotations. Length masks and minimum lengths reject most members before any string comparison. The memoizer indexes registered patterns by what their names require and routes each member only to the patterns it could satisfy, calling the final class directly; other matchers still see every member. Member matchers in the instrumentations are migrated to patterns, except declaredBy matchers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
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. |
Kafka / producer-benchmarkParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 3 metrics, 0 unstable metrics. See unchanged results
|
Kafka / consumer-benchmarkParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 3 metrics, 0 unstable metrics. See unchanged results
|
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
Stacked on #13744. Replaces the generic
ElementMatcherpredicate chains used for memoized member matching with one compiled matcher class, and has the memoizer route each member only to the matchers that could match it.MemberPattern(a single final class) matches fields and methods by:methodNamed(...), or a single*at the start or end ("block*","*Async"). Method names are internal names ("<init>"for constructors).?stands for one whole parameter (or the return type), and a trailing*for any remaining parameters."(??)?"takes exactly two parameters;"(Ljava/lang/String;*)V"takes aStringfirst and returnsvoid. Field descriptors are exact.notStatic().methodAnnotatedWith(...)registers them as annotations of interest, likeisAnnotatedWith.Cheap checks come first: flags, then a name-length bitmask and name buckets, then the descriptor's minimum length, then the descriptor, and annotations last.
MemberIndex(in the memoizer) indexes patterns by what their names require: exact names in a map behind a combined length mask, prefixes and suffixes in short lists, and nameless patterns by whether they need annotations. Each member is routed to the few patterns its name could satisfy, which are called directly on the final class (monomorphic). Any other matcher is residual and still sees every member. Routing only selects candidates; each selected pattern still decides.Migration: every memoized member matcher in the instrumentations moves to
MemberPattern, except the twodeclaredBy(...)matchers (JAX-WS / Jakarta WS) and code origin (off by default), which stay on the residual path. For example, jacoco'sbecomes
method("visitMethodInsn", "(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)?").Motivation
Profiling memo builds showed the cost was not any one slow matcher but volume: every declared member of every memoized type went through all ~21 method matchers (or 13 field matchers), about 1.6 million generic matcher calls per PetClinic startup, of which only a few dozen match.
Results
Behavior: PetClinic transforms the identical set of 114 classes as
master(startup plus traffic), with no transformation failures.Memoizer timings (triage metrics, PetClinic startup, 4 interleaved runs per build):
Tests:
MemberPatternTest(25 cases): descriptor-pattern grammar and edge cases, and equivalence with the replaced ByteBuddy predicates (exact names, sets, prefixes and suffixes, parameter counts, typed and array parameters, return types, flags, field descriptors, annotations) over every member of a corpus of real classes.MemberIndexTest: routing records exactly the same matches as evaluating every matcher, for every member of the corpus, including residual matchers.What's left after this
declaredBymatchers are per-type facts still evaluated per member; evaluating them once per type is the next small step.Strings inClassFile.outline; the same pattern checks can run on class-file bytes, starting with theu2length before any compare.Additional Notes
Formatting applied with
spotlessApply. Two modules were skipped by the local build because they need private repositories (restlet-2.2, akka-http-10.6); neither is touched.🤖 Generated with Claude Code