Repository navigation
Conversation
…dule Moves the toolbox primitives that have no dependencies outside the JDK out of internal-api, with their tests: Hashtable, FlatHashtable, StringIndex, ChunkedBuffer, Cursor, Maybe, the hashing utilities, BitUtils and FNV64Hash, plus the contract annotations and the Strategy, StrategyConsumer and NoEscape markers. Package names do not change, and internal-api re-exports the module, so callers are unchanged. Strings.caseInsensitiveHashCode moves to HashingUtils, which FlatHashtable uses. Strings keeps the method and delegates to it. The agent's shared and per-product jars exclude the module, as they do the other bootstrap components, so each class is packaged once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The moved classes passed under internal-api's thresholds (0.7 branch, 0.8 instruction). The new module got the 0.9 default instead, which failed coverage verification for seven of them. Using internal-api's thresholds keeps enforcement exactly as it was before the move. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nothing calls the Strings delegate, so drop it and move its test next to HashingUtils. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cies The toolbox was extracted from internal-api, so it keeps the strict core performance rules in AGENTS.md and the perf-review posture. Its lockfile now covers the test configurations too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It only depends on toolbox classes, plus TriFunction, which moves with it in the same package, as Strategy did. internal-api exposes the toolbox as an api dependency, so its users compile unchanged. The size-manager test polls the thread state itself rather than through test-utils, so the toolbox tests keep junit as their only dependency, and hashIterator gets a direct test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ConcurrentHashtable, StringIndex and FlatHashtable are on master and now live in components/toolbox; StringCanonicalizer and LruTable are coming. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EscapeShapeBenchmark's arms are mergeWithStatic and mergeOfTwoAllocations now, and "merge of several allocations" replaces the compiler term "phi". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A map built once and then only read, held in parallel key and value arrays in the source map's iteration order: scanned up to eight entries, indexed by an open-addressed int[] beyond that. It drops the node per entry, the table and any unmodifiable wrapper of a HashMap, keeps the source order (unlike Map.copyOf), lets get(null) miss, and never caches its views. forEach walks the arrays without allocating. ImmutableMapBenchmark gains FrozenMap arms: get at ten keys (indexed) and at eight (scanned), with distinct and identical key instances, and iteration through entrySet and forEach. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LLM ValidationLLM Validation Gate — java-agent-instructions✅ PASS
6 case(s) · quality 80.8 → 81.0 (+0.1) · win-rate 49% [43%–54%] 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. |
Contributor
Contributor
🟢 Java Benchmark SLOs — All performance SLOs passed
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. |
ImmutableMapBenchmark found the 8-key scan 37% slower than the 10-key index. FrozenMapScanBenchmark measures get at 1 to 16 entries with the map built to scan and to index, to place the threshold. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FrozenMapScanBenchmark found the scan clearly faster up to 3 entries, level at 4, and slower from 6; at 8 it was 17-27% slower than the index. Keep scanning through 4, where skipping the index saves its array at no measurable cost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dougqh
force-pushed
the
dougqh/toolbox-component
branch
2 times, most recently
from
November 24, 2026 02:03
5c9275f to
0dbdb72
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Does This Do
Stacked on #13531.
Adds
FrozenMap<K, V>to the toolbox: a read-onlyMap, built once and then only read, held in flat arrays instead of one node per entry.int[]index into the arrays, at most half full.HashMapbehind an unmodifiable wrapper: it drops the node per entry, the table and the wrapper. That's about 8 B per entry plus the arrays' headers, against about 40 B per entry plus some 80 B per map.Map.copyOf: it keeps the source's iteration order, andget(null)misses instead of throwing.entrySet,keySetandvaluesare created on each call and never cached, so a retained map holds no view objects.HashMapkeeps each view it has handed out.forEachwalks the arrays without allocating.ImmutableMapBenchmarkgainsFrozenMaparms:getat ten keys, which uses the index;getat eight keys, which scans;entrySetand throughforEach.Motivation
The FFE SDK keeps a read-only
Valuetree for each JSON flag variant (#13484). Each JSON object holds its attributes in aHashMapbehind an unmodifiable wrapper. On thescale-jsonbenchmark fixture, that's 271kHashMap$Nodes and about 106k map and wrapper objects, out of about 1.5M objects retained. A prototype on top of #13484 (dougqh/ffe-json-hash-cons) uses an FFE-local version of this map, and its retained size is being measured now. This PR adds the general-purpose version to the toolbox.Additional Notes
Measurement
ImmutableMapBenchmark, JDK 17, run by a benchmark worker on 5 CPUs with-t 4and about 22% steal, so compare the arms with each other rather than with the M1 table in the Javadoc. Million ops/s, median of 5 forks. Every arm allocates about 0 B/op exceptiterate_tagMap(72 B).Map.copyOf(MapN)get: indexed,FrozenMapbeatsMap.copyOfby 54% (64% with the same key instance). It's belowHashMap(−18%) andStringIndex(−11%). No fork ranges overlap.entrySetiteration allocates nothing, since escape analysis removes the per-element entry, and it's the fastest iteration arm, at 3.3×Map.copyOf's.forEachis 33% slower than the iterator.JDK 21 (same host and settings), million ops/s:
FrozenMapindexedget214.5 and same-key 335.8, againstMap.copyOf's 151.2 and 229.2 (+42% and +47%),HashMap's 192.5 and 595.7, andStringIndex's 244.3 and 408.9. Iteration: 246.4 (iterator) and 147.4 (forEach), againstMap.copyOf's 69.6. Everything allocates about 0 B/op.Scan threshold:
FrozenMapScanBenchmark(JDK 17, about 1% steal) sweeps 1–16 entries. Scanning clearly wins up to 3 entries (+11%get, +24% same key), ties at 4, and loses from 6; at 8 it's 17–27% slower.MAX_SCANNEDis now 4: at the tie, skipping the index saves its array.🤖 Generated with Claude Code