Skip to content

Bloom-filter fast-path for the dense tag store (O(1) insertion)#11900

Draft
dougqh wants to merge 1 commit into
dougqh/dense-storefrom
dougqh/dense-bloom-filter
Draft

Bloom-filter fast-path for the dense tag store (O(1) insertion)#11900
dougqh wants to merge 1 commit into
dougqh/dense-storefrom
dougqh/dense-bloom-filter

Conversation

@dougqh

@dougqh dougqh commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What

Adds a per-map bloom-style presence filter (one long, knownBloom) to OptimizedTagMap's dense known-tag store. A clear bit means a known tag is definitely absent, so an append skips the O(n) knownIndexOf linear scan — the common per-span-build case (each tag set once) becomes O(1).

Correctness — superset invariant

The filter is a superset of the present ids' bits: set on every add, never cleared on remove (a stale-set bit only costs an unnecessary scan, never a wrong answer). The linear scan stays authoritative — a set bit means "maybe present, scan to confirm." So correctness is independent of the position→bit collision rate; only the fast-path hit rate depends on it. All 339 TagMap + dense fuzz tests pass.

Position→bit mapping

Crude 1L << (fieldPos & 63) to start. fieldPos (not globalSerial) is deliberate: it's the axis a future per-type graph-coloring optimizes — coloring co-occurring tags to distinct positions raises the fast-path hit rate without touching correctness.

Why (evidence)

On the stacked id-comparison benchmark, the bloom brings dense id-insertion to HashMap parity at typical tag counts (0.99× at 7 tags, up from 0.91× without it), while dense still allocates ~half of HashMap. Cost: +8 B/op (the single long field). The demonstrating benchmark lands in the stacked id PR.

Stacking

Dense-store id line: #11814 (Entry-less storage) → this (bloom fast-path) → id API + comparison benchmark. Based on dougqh/dense-store.

Follow-ups

Per-type graph coloring (raises hit rate); multi-level transitive prune for read-through (skip parents whose bit is clear).

🤖 Generated with Claude Code

A per-map superset presence filter (one long): a clear bit means a known tag is
definitely absent, so an append skips the O(n) linear scan -> O(1) in the common
per-build case. Set on every add, never cleared on remove (stale bit only costs a
scan, never a wrong answer), so correctness is independent of the position->bit
collision rate; the scan is authoritative. Crude fieldPos-mod-64 mapping to start;
per-type graph-coloring later raises the hit rate. WIP: tests + benchmark pending.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@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 13.96 s 13.83 s [+0.3%; +1.5%] (maybe worse)
startup:insecure-bank:tracing:Agent 12.87 s 12.98 s [-1.5%; -0.1%] (maybe better)
startup:petclinic:appsec:Agent 17.49 s 17.50 s [-1.4%; +1.3%] (no difference)
startup:petclinic:iast:Agent 17.43 s 17.50 s [-1.0%; +0.2%] (no difference)
startup:petclinic:profiling:Agent 17.42 s 17.49 s [-1.3%; +0.6%] (no difference)
startup:petclinic:sca:Agent 17.49 s 17.44 s [-0.5%; +1.1%] (no difference)
startup:petclinic:tracing:Agent 16.45 s 16.64 s [-2.2%; -0.1%] (maybe better)

Commit: 428e72ff · 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.

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