Skip to content

Add FlatHashtable open-addressed find-or-create collection#11980

Draft
dougqh wants to merge 2 commits into
masterfrom
dougqh/flat-hashtable
Draft

Add FlatHashtable open-addressed find-or-create collection#11980
dougqh wants to merge 2 commits into
masterfrom
dougqh/flat-hashtable

Conversation

@dougqh

@dougqh dougqh commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

From Claude:

A reusable open-addressed table over self-contained entries — one reference per slot, so entry publication is a single reference store and readers see null-or-complete (no torn reads, no volatile/atomics needed when the payload makes a stale/lost read benign).

Callers specialize it via a concrete-typed static final Helper (or StringHelper) that the JIT devirtualizes and inlines — C++-template-style static polymorphism: one algorithm, one monomorphic instantiation per call site. Helper is an abstract class on purpose (forces a named type; invokevirtual fallback if inlining ever misses); StringHelper seals a spread hash so String-key callers write only matches/create.

Pure mechanism — capacityFor, create (typed backing array via Array.newInstance), get, getOrCreate. Cardinality cap / overflow / a live-size counter are caller policy.

Intended as the shared backing for several open-addressed caches/tables (per-operation sizing hints, UTF8BytesString caches, …). This PR is just the standalone collection + unit tests; callers land separately.

Draft caveat: authored without a local module build (to stay off an in-progress release), so spotlessCheck / spotbugsMain / compile want CI (or a spotlessApply pass) to confirm.

🤖 Generated with Claude Code

…hism helpers

A reusable open-addressed table over self-contained entries (one reference per
slot), designed so callers specialize it via a concrete-typed static-final
Helper that the JIT devirtualizes and inlines (C++-template-style static
polymorphism). Cardinality cap / overflow / size are caller policy; this class
is pure mechanism (capacityFor, create, get, getOrCreate). Includes a
String-key StringHelper that seals a spread hash.

Intended as the shared backing for several open-addressed caches/tables
(per-operation sizing hints, UTF8BytesString caches, etc.).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dougqh dougqh added comp: core Tracer core 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 Jul 16, 2026
@datadog-prod-us1-6

This comment has been minimized.

@dd-octo-sts

dd-octo-sts Bot commented Jul 16, 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.98 s 13.93 s [-0.4%; +1.2%] (no difference)
startup:insecure-bank:tracing:Agent 13.01 s 13.10 s [-1.3%; -0.1%] (maybe better)
startup:petclinic:appsec:Agent 16.88 s 16.77 s [-0.3%; +1.7%] (no difference)
startup:petclinic:iast:Agent 16.88 s 17.00 s [-1.6%; +0.3%] (no difference)
startup:petclinic:profiling:Agent 16.63 s 16.85 s [-2.5%; -0.1%] (maybe better)
startup:petclinic:sca:Agent 16.97 s 16.81 s [-0.1%; +2.0%] (no difference)
startup:petclinic:tracing:Agent 16.03 s 16.11 s [-1.4%; +0.5%] (no difference)

Commit: 8e3862cc · 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.

Force hash collisions via fixed-hash helpers to exercise the linear-probe
paths the original tests missed: probe-past-occupied + match-after-probe (in
both get and getOrCreate), wraparound to the front, and get()'s full-table
wrap-to-null branch.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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