Skip to content

Visit not-yet-adapted outline members with flyweight outlines - #13744

Draft
dougqh wants to merge 1 commit into
dougqh/lazy-type-outlinefrom
dougqh/memoizer-member-prefilter
Draft

dougqh wants to merge 1 commit into
dougqh/lazy-type-outlinefrom
dougqh/memoizer-member-prefilter

Conversation

@dougqh

@dougqh dougqh commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

Stacked on #13743. The memoizer evaluates every registered field and method matcher against every declared member of every memoized type. For outlines whose members haven't been adapted yet, OutlineMembers.visitFields / visitMethods now visit them with one flyweight FieldOutline / MethodOutline per kind, re-pointed at each member in turn, instead of adapting every member into its own object.

  • MethodOutline and FieldOutline gain a package-private point(...). Method annotations of interest are kept as names and adapted only when someone asks (most methods have none).
  • Adapted outlines, and types that aren't outline-backed, are visited from their member lists exactly as before.
  • Rule: a flyweight is only valid during the visit that passed it, and matchers must not retain it. Memoized matchers only set bits.
  • No matcher classification, no reflection, no changes to matchers.

Motivation

Measured on PetClinic startup with temporary counters (members visited by the memoizer, and how many any matcher could match):

Members evaluated Could match Hit rate
Fields 14,646 5 0.03%
Methods 69,483 44 0.06%

About 84,000 member objects were built per startup to find a few dozen hits.

Results

  • Behavior: PetClinic transforms the identical set of 114 classes as master (startup plus traffic), with no transformation failures.
  • Tests: new OutlineMembersTest: flyweight visits match adapted members field by field, including through CachingType; adapted types are visited from their lists; context is passed through. All bytebuddy tests in agent-tooling pass.
  • Cost, honestly: this PR is structural. Memoizer timings (triage metrics, 3 startups each) show no measurable change in memo building, and allocation under the outline and memoizer code drops modestly, within sampling noise of whole-process allocation.
PetClinic startup master #13743 this PR
Build type-memo (5,562) 159 / 171 / 179 ms 164 / 165 / 168 ms 160 / 171 / 185 ms
Build type-outline (~6,020) 103 / 103 / 106 ms 91 / 99 / 105 ms 95 / 99 / 103 ms

Where the matching cost actually is

Cost (PetClinic startup, master) Size Addressed by
Re-resolving supertypes ~125 ms (measured by turning memoization off: ~1,760 more outlines parsed) memoization, which earns its keep here
Per-instrumentation type-matcher dispatch ~210 ms, ~814,000 calls (classes × instrumentations) constant-pool needle table / sieve (separate work)
Member matching inside memo builds ~170 ms, ~1.6M generic matcher calls (~100 ns each) literal / descriptor-pattern member matchers (next stacked PR, which uses these flyweights)

Additional Notes

Formatting applied with spotlessApply.

🤖 Generated with Claude Code

The memoizer evaluates every field and method matcher against every
declared member of every memoized type. For outlines whose members haven't
been adapted yet, OutlineMembers now visits them with one flyweight
MethodOutline / FieldOutline per kind, re-pointed at each member, instead of
adapting every member into its own object. Adapted outlines, and types that
aren't outline-backed, are visited from their member lists as before.

Method annotations of interest are kept as names and adapted only on
request. A flyweight is only valid during the visit that passed it;
matchers must not retain it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dougqh dougqh added comp: core Tracer core tag: performance Performance related changes tag: no release notes Changes to exclude from release notes type: refactoring tag: ai generated Largely based on code generated by an AI or LLM labels Dec 1, 2026
@datadog-official

datadog-official Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
• Patch Coverage: 0.00%
• Overall Coverage: 63.52% (-0.05%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 3ed590e | Docs | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.08 s 13.95 s [+0.2%; +1.7%] (maybe worse)
startup:insecure-bank:tracing:Agent 12.96 s 13.01 s [-1.0%; +0.1%] (no difference)
startup:petclinic:appsec:Agent 17.18 s 17.03 s [+0.0%; +1.7%] (maybe worse)
startup:petclinic:iast:Agent 17.11 s 17.11 s [-0.8%; +0.7%] (no difference)
startup:petclinic:profiling:Agent 16.64 s 16.88 s [-2.2%; -0.6%] (maybe better)
startup:petclinic:sca:Agent 17.16 s 16.36 s [-0.9%; +10.7%] (unstable)
startup:petclinic:tracing:Agent 15.80 s 16.27 s [-8.4%; +2.6%] (unstable)

Commit: 3ed590ee · CI Pipeline · Benchmarking Platform UI


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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: core Tracer core tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes tag: performance Performance related changes type: refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant