Repository navigation
Spread StringIndex hashes so sequential names don't cluster (FFE optimization) - #13576
Conversation
LLM ValidationLLM Validation Gate — java-agent-instructions✅ PASS
6 case(s) · quality 82.1 → 82.3 (+0.1) · win-rate 49% [45%–53%] Details — analysis and per-case resultsAnalysisChanged instruction file(s): 1 case(s) dipped but stayed within the pass bar.
Results
Cases
Per-dimension scores, token usage, latency, and estimated cost are in the CI job logs. |
🟡 Java Benchmark SLOs — Performance SLO warning (near threshold)
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0f0e032dcc
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
More details
StringIndex construction and lookup remain consistent with the new spread, including the reserved zero sentinel. FlatHashtable retains its existing slot calculation; runtime lookup cost remains unmeasured.
🤖 Bits Code Review · Commit 0f0e032
0f0e032 to
225288e
Compare
There was a problem hiding this comment.
More details
StringIndex uses the new spread consistently for insertion and lookup, and FlatHashtable retains the same slot calculation. Lookup timing remains unmeasured.
🤖 Bits Code Review · Commit 225288e
94db48f to
fc4cd13
Compare
There was a problem hiding this comment.
More details
StringIndex preserves consistent hashing between construction and lookup and reserves zero for empty slots. FlatHashtable retains identical slot placement.
🤖 Bits Code Review · Commit fc4cd13
fc4cd13 to
10d466d
Compare
There was a problem hiding this comment.
More details
StringIndex preserves consistent hashing between table construction and lookup, while FlatHashtable retains its existing slot calculation. The completed static review produced no actionable findings.
🤖 Bits Code Review · Commit 10d466d
StringIndex spread String.hashCode with h ^ (h >>> 16), so names that differ only in a trailing counter landed in adjacent slots and grew long linear-probe runs: 10,030 names like scale-bulk-NNNNN averaged 6.3 probes, with a worst case of 156. HashingUtils.hashSpread is FlatHashtable's golden-ratio multiply and fold, made public; StringIndex now uses it, and the same names average 1.2 probes with a worst case of 10. FlatHashtable's slots are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HashingUtils.hashSpread now takes an int and spreads it with a 32-bit golden-ratio multiply folded by >>> 15. On StringIndex lookups it keeps the 64-bit version's gain on sequential misses (-27% to -49%) while random-key hits stay within noise of the old h ^ (h >>> 16), where the 64-bit multiply cost +4-5%. On 10,030 sequential names it averages 1.20 probes with a worst case of 10. The 64-bit version moves to LongHashingUtils.hashSpread(long), which FlatHashtable keeps for its composite hashes, so its slots don't change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
String.format now uses Locale.ROOT in the StringIndex regression test and benchmark, so names stay ASCII under any default locale. The spread test also checks the longest run of occupied slots: distinct slots alone pass for the old XOR spread, which keeps 0..999 adjacent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
10d466d to
74dd6ff
Compare
There was a problem hiding this comment.
More details
The hash-spread change preserves StringIndex’s empty-slot sentinel and FlatHashtable’s existing slot calculation. The completed static review found no actionable defect; tests and performance benchmarks were not executed.
🤖 Bits Code Review · Commit 74dd6ff
…tack # Conflicts: # internal-api/src/main/java/datadog/trace/util/FlatHashtable.java
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
What Does This Do
HashingUtils.hashSpread(int): a 32-bit golden-ratio multiply folded with>>> 15, for hash codes.LongHashingUtils.hashSpread(long):FlatHashtable's existing 64-bit multiply and fold, made public, for composite hashes.StringIndex.EmbeddingSupport.hashspreadsString.hashCodewithHashingUtils.hashSpreadinstead ofh ^ (h >>> 16).0stays reserved as the empty-slot sentinel.FlatHashtable.homecallsLongHashingUtils.hashSpread. Its slots don't change.StringIndexKeyShapeBenchmark(internal-api JMH): lookup hits and misses on sequential and random names, at 64, 1,024 and 10,030 entries.Motivation
Names that differ only in a trailing counter, such as generated keys like
scale-bulk-NNNNN, have nearly equalString.hashCodes.h ^ (h >>> 16)keeps them nearly equal, so they fill runs of adjacent slots and linear probing walks those runs. Placing 10,030 such names atStringIndex's default load factor (exact counts):h ^ (h >>> 16)>>> 15(this PR)StringIndexKeyShapeBenchmark(Bits, JDK 21, 5 forks per variant, 4 threads, steal median 0.14%): median fork in ns/op [fork range], 0 B/op throughout:h ^ (h >>> 16)>>> 15(this PR)* One bimodal fork; the other four were 22.1–22.7.
>>> 16instead of>>> 15was clearly worse on random hits at 64 entries (+9%).Additional Notes
components/toolboxextraction). It now lands on its own ininternal-api; the relocation can follow separately.int/longoverload on one class: an overload would silently pick a different spread depending on the argument's type. Splitting by class keeps the input width explicit, matchingHashingUtils(int hashes) andLongHashingUtils(long hashes).StringIndextables are always built at runtime withEmbeddingSupport.hash, so nothing stored depends on the old values.StringIndexTestchecks probe lengths through StringIndex's real placement.HashingUtilsTestchecks that 1,000 consecutive hash codes take 866 of 4,096 slots, close to random placement.StringCanonicalizer(Introduce a reusable string canonicalizer for FFE parsing #13588) builds on this spread.Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issue🤖 Generated with Claude Code