You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Memoize per-test class analysis in a module-wide cache (#11969)
Memoize per-test class analysis in a module-wide cache
Jacoco's Analyzer re-parsed each covered class once per test, dominating
line-coverage report cost. Cache the covered lines per (class id, probe set),
shared across tests, so a class covered identically by many tests is analyzed
only once. Recording path is unchanged, so Jacoco's aggregate coverage is
preserved by its native probe writes (no probe-array swap).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Bound the analysis cache by memory, and snapshot probes consistently
Addresses Codex review of the memoization cache:
- Bit-pack the probe activations into a BitSet in the key (~8x smaller than the
test's boolean[], exact equality).
- Cap the cache by approximate retained bytes rather than entry count, so a class
with many probes covered by many distinct probe sets can't retain unbounded
memory for the module lifetime.
- Reserve an entry's weight atomically before insertion (release on over-limit or
lost putIfAbsent race) so concurrent inserts can't overshoot the bound.
- Count fixed per-entry overhead (key + both BitSets + map node), not just the
packed bits, so the byte bound is a real ceiling.
- Snapshot the per-test probe array once and use that same snapshot for both the
cache key and the JaCoCo analysis, so a late probe recorded by a background
thread during report() can't be analyzed into coveredLines yet stored under the
earlier key, poisoning the entry for later tests.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: daniel.mohedano <daniel.mohedano@datadoghq.com>
Copy file name to clipboardExpand all lines: dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/coverage/line/ExecutionDataAdapter.java
Copy file name to clipboardExpand all lines: dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/coverage/line/LineCoverageStore.java
0 commit comments