Skip to content

Id-keyed TagMap.set(long) + insertion-comparison benchmark (phase 2)#11901

Draft
dougqh wants to merge 1 commit into
dougqh/generator-v2from
dougqh/tag-id-api
Draft

Id-keyed TagMap.set(long) + insertion-comparison benchmark (phase 2)#11901
dougqh wants to merge 1 commit into
dougqh/generator-v2from
dougqh/tag-id-api

Conversation

@dougqh

@dougqh dougqh commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What

On top of the bloom fast-path (#11900):

  1. TagMap.set(long id, Object) — the id-keyed insertion path: given a resolved KnownTags.*_ID, store densely and skip keyOf name resolution. Sole TagMap impl (OptimizedTagMap); the id must be a stored known id (custom names keep the name setters).
  2. TagMapInsertionComparisonBenchmark — HashMap / 1.0-bucket / 2.0-name / 2.0-id, alloc + throughput; the numbers behind the deck's slides 3/7/8.

Results (idle box, -prof gc -f 5 -wi 5 -i 5; persisted in the benchmark header)

arm alloc B/op (7 / 12) thrpt vs HashMap (7 / 12)
hashMap 352 / 512 1.00× / 1.00×
tagMapById 184 / 408 0.99× / 0.63×
tagMapByName 184 / 408 0.66× / 0.50×
tagMapCustom (1.0 bucket) 416 / 712 0.59× / 0.46×
  • Alloc: dense ~half of HashMap; id == name (the bloom/dense win is CPU, not alloc).
  • Throughput: id-insertion reaches HashMap parity at typical tag counts (0.99× @7) and beats the 1.0 bucket path 1.4–1.7×. The 12-tag gap is a sizing/resize artifact (SpanPrototype's right-sizing / a larger init cap closes it), not a scan — the tags don't collide under the bloom's fieldPos & 63.

Scope

Minimal id API (TagMap level). Full AgentSpan.setTag(long) + the KnownTags call-site migration are follow-ons. set(long) has no production caller yet — by design, it lands with its benchmark evidence ahead of the migration that consumes it (each PR stands alone in sequence).

Stacking

#11814 (dense storage) → #11900 (bloom) → this (id API + comparison benchmark).

Follow-ups

TagMap.Ledger + SpanBuilder id support; per-type graph coloring; master run to pin true-1.0 (no keyOf).

🤖 Generated with Claude Code

@dougqh dougqh added 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 type: refactoring labels Jul 9, 2026
@dd-octo-sts

dd-octo-sts Bot commented Jul 9, 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.00 s 13.96 s [-0.6%; +1.1%] (no difference)
startup:insecure-bank:tracing:Agent 12.95 s 13.00 s [-1.0%; +0.3%] (no difference)
startup:petclinic:appsec:Agent 16.84 s 16.64 s [+0.1%; +2.3%] (maybe worse)
startup:petclinic:iast:Agent 16.77 s 16.87 s [-1.5%; +0.2%] (no difference)
startup:petclinic:profiling:Agent 16.47 s 16.63 s [-1.9%; -0.1%] (maybe better)
startup:petclinic:sca:Agent 16.81 s 16.01 s [+0.7%; +9.3%] (maybe worse)
startup:petclinic:tracing:Agent 16.13 s 15.73 s [-1.8%; +7.0%] (no difference)

Commit: 3295baaf · 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.

@dougqh
dougqh force-pushed the dougqh/dense-bloom-filter branch 2 times, most recently from 267ebad to 56550cb Compare July 15, 2026 21:23
@dougqh
dougqh changed the base branch from dougqh/dense-bloom-filter to dougqh/tag-registry-generator July 15, 2026 21:27
@dougqh
dougqh force-pushed the dougqh/tag-id-api branch from f0cb351 to 7e3ed31 Compare July 15, 2026 21:27
@datadog-prod-us1-6

datadog-prod-us1-6 Bot commented Jul 15, 2026

Copy link
Copy Markdown

🎯 Code Coverage (details)
Patch Coverage: 63.81%
Overall Coverage: 57.38% (+0.07%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 3295baa | Docs | Datadog PR Page | Give us feedback!

@dougqh
dougqh force-pushed the dougqh/tag-registry-generator branch from ad3c1f7 to 369a591 Compare July 22, 2026 16:32
@dougqh dougqh changed the title Id-keyed TagMap.set(long) + insertion-comparison benchmark Id-keyed TagMap.set(long) + insertion-comparison benchmark (phase 2) Jul 23, 2026
@datadog-prod-us1-6

datadog-prod-us1-6 Bot commented Jul 23, 2026

Copy link
Copy Markdown

Bits has a CI fix ready

🟢 Investigated · 🟢 Fix prepared · ⚪ Validation skipped · 🟠 Ready

The dense-tag initialization comment in dd-trace-core/src/main/java/datadog/trace/core/CoreTracer.java exceeded Spotless's required line wrapping. Wrapped it across two lines.

Commit fix to this PR


View in Datadog | Reviewed commit 3295baa · Any feedback? Reach out in #deveng-pr-agent

set(long id, Object value) is the id-keyed insertion path: the caller passes a
resolved KnownTags id, so it skips the keyOf name resolution the set(String, ...)
methods pay and stores densely. The id must be a stored known-tag id; custom
names have no id and use the name-keyed setters. The name is resolved lazily only
to clear a read-through tombstone (rare).

Adds TagMapInsertionComparisonBenchmark (dense vs HashMap insertion, -prof gc) —
the isolated micro where the dense store + bloom insertion win shows, and the
home for the id-keyed vs string-keyed comparison.

Reconciled onto the tag registry (#11961).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dougqh
dougqh changed the base branch from dougqh/tag-registry-generator to dougqh/generator-v2 July 23, 2026 03:08
@dougqh
dougqh force-pushed the dougqh/tag-id-api branch from 7e3ed31 to 3295baa Compare July 23, 2026 03:08
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 type: refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant