Repository navigation
Conversation
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. |
…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>
dougqh
added a commit
that referenced
this pull request
Nov 20, 2026
Shares one String per distinct text within one parse, from a parser's char buffer or from strings, so long-lived parsed state keeps a single copy of each repeated key, id or value. Sharing is per instance, never JVM-wide, because parsed texts can be customer data. Generalized from dd-openfeature's version (#13553) with the review fixes built in: the hashSpread multiply instead of h ^ (h >>> 16), a bound on equal-hash comparisons so input built from colliding strings can't make each lookup compare against all the others, and a length limit above which texts are neither hashed nor shared. StringCanonicalizerBenchmark compares it with plain new String, a HashMap interner and the original version, over generated keys, random ids and colliding strings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dougqh
added a commit
that referenced
this pull request
Nov 20, 2026
Shares one String per distinct text within one parse, from a parser's char buffer or from strings, so long-lived parsed state keeps a single copy of each repeated key, id or value. Sharing is per instance, never JVM-wide, because parsed texts can be customer data. Generalized from dd-openfeature's version (#13553) with the review fixes built in: the hashSpread multiply instead of h ^ (h >>> 16), a bound on equal-hash comparisons so input built from colliding strings can't make each lookup compare against all the others, and a length limit above which texts are neither hashed nor shared. StringCanonicalizerBenchmark compares it with plain new String, a HashMap interner and the original version, over generated keys, random ids and colliding strings. 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>
dougqh
added a commit
that referenced
this pull request
Nov 20, 2026
Shares one String per distinct text within one parse, from a parser's char buffer or from strings, so long-lived parsed state keeps a single copy of each repeated key, id or value. Sharing is per instance, never JVM-wide, because parsed texts can be customer data. Generalized from dd-openfeature's version (#13553) with the review fixes built in: the hashSpread multiply instead of h ^ (h >>> 16), a bound on equal-hash comparisons so input built from colliding strings can't make each lookup compare against all the others, and a length limit above which texts are neither hashed nor shared. StringCanonicalizerBenchmark compares it with plain new String, a HashMap interner and the original version, over generated keys, random ids and colliding strings. 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>
dd-openfeature is published on its own and must work with any attached agent version, so it can't depend on the toolbox module. Instead its published jar carries a relocated copy of the toolbox classes it uses, under com.datadog.openfeature.internal.shaded, and Shadow's minimize() drops the classes it doesn't reach. The Shadow plugin is not applied: publish.gradle would then list only api dependencies in the POM and drop opentelemetry-api. A ShadowJar task replaces the jar of the java component's apiElements and runtimeElements instead, so the publication and its POM are unchanged. The plain jar moves to the "unbundled" classifier, and the japicmp checks compare the published jar. checkToolboxRelocation, run by check, fails if an unrelocated toolbox class reaches the jar. Nothing in the SDK uses the toolbox yet, so the published jar has the same entries as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
compareToReferenceJar (jardiff) compares the module's jar task output unless the Shadow plugin is applied. Here the plain jar moved to the "unbundled" classifier and toolboxJar became the published jar, so the check looked for an unbundled jar the reference set doesn't have. It now compares the published, shaded jar; a clean rebuild matches it byte for byte. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI runs :dd-openfeature:jar and collects build/libs/*.jar, but jar now builds the unbundled jar into build/libs-unbundled, which left nothing for validate_build, the S3 upload or system-tests. jar is now finalized by toolboxJar, which writes the shaded jar to build/libs. The shaded jar also takes the plain jar's manifest, so it keeps the Implementation-* attributes the jar convention sets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
Shares one String per distinct text within one parse, from a parser's char buffer or from strings, so long-lived parsed state keeps a single copy of each repeated key, id or value. Sharing is per instance, never JVM-wide, because parsed texts can be customer data. Generalized from dd-openfeature's version (#13553) with the review fixes built in: the hashSpread multiply instead of h ^ (h >>> 16), a bound on equal-hash comparisons so input built from colliding strings can't make each lookup compare against all the others, and a length limit above which texts are neither hashed nor shared. StringCanonicalizerBenchmark compares it with plain new String, a HashMap interner and the original version, over generated keys, random ids and colliding strings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…zer' into dougqh/ffe-share-strings-toolbox
A parsed configuration repeats the same texts many times: field names, flag and variation keys, attribute names and condition values. Parse each document through one toolbox StringCanonicalizer, a bounded, per-parse table, so each distinct text is kept once. Its table is dropped with the parse, so it never grows JVM-wide the way String.intern()'s does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dougqh
force-pushed
the
dougqh/ffe-config-share-strings
branch
from
November 23, 2026 14:00
d633d4a to
4400165
Compare
LLM ValidationLLM Validation Gate — java-agent-instructions✅ PASS
6 case(s) · quality 80.6 → 82.3 (+1.7) · win-rate 53% [50%–56%] Details — analysis and per-case resultsAnalysisChanged instruction file(s): No safety or blocking-case regressions across 6 case(s). Overall pairwise win-rate 53% [50%–56%], quality +1.7 — see the verdict above for whether that clears the noise band. Results
Cases
Per-dimension scores, token usage, latency, and estimated cost are in the CI job logs. |
dougqh
added a commit
that referenced
this pull request
Nov 23, 2026
Shares one String per distinct text within one parse, from a parser's char buffer or from strings, so long-lived parsed state keeps a single copy of each repeated key, id or value. Sharing is per instance, never JVM-wide, because parsed texts can be customer data. Generalized from dd-openfeature's version (#13553) with the review fixes built in: the hashSpread multiply instead of h ^ (h >>> 16), a bound on equal-hash comparisons so input built from colliding strings can't make each lookup compare against all the others, and a length limit above which texts are neither hashed nor shared. StringCanonicalizerBenchmark compares it with plain new String, a HashMap interner and the original version, over generated keys, random ids and colliding strings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dougqh
added a commit
that referenced
this pull request
Nov 24, 2026
Shares one String per distinct text within one parse, from a parser's char buffer or from strings, so long-lived parsed state keeps a single copy of each repeated key, id or value. Sharing is per instance, never JVM-wide, because parsed texts can be customer data. Generalized from dd-openfeature's version (#13553) with the review fixes built in: the hashSpread multiply instead of h ^ (h >>> 16), a bound on equal-hash comparisons so input built from colliding strings can't make each lookup compare against all the others, and a length limit above which texts are neither hashed nor shared. StringCanonicalizerBenchmark compares it with plain new String, a HashMap interner and the original version, over generated keys, random ids and colliding strings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dougqh
force-pushed
the
dougqh/ffe-toolbox-shading
branch
from
November 24, 2026 02:04
676974d to
97180eb
Compare
dougqh
added a commit
that referenced
this pull request
Nov 24, 2026
Shares one String per distinct text within one parse, from a parser's char buffer or from strings, so long-lived parsed state keeps a single copy of each repeated key, id or value. Sharing is per instance, never JVM-wide, because parsed texts can be customer data. Generalized from dd-openfeature's version (#13553) with the review fixes built in: the hashSpread multiply instead of h ^ (h >>> 16), a bound on equal-hash comparisons so input built from colliding strings can't make each lookup compare against all the others, and a length limit above which texts are neither hashed nor shared. StringCanonicalizerBenchmark compares it with plain new String, a HashMap interner and the original version, over generated keys, random ids and colliding strings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 #13532, which shades the toolbox into dd-openfeature. It merges in #13588 (the toolbox
StringCanonicalizer, itself on #13576), whose commits drop out of this diff once those land. The only commit of this PR is440016510f.A parsed feature flag configuration now keeps one
Stringfor each distinct text, however many times the document repeats it: attribute names, variation keys, allocation keys, salts,ONE_OFvalues, and map keys together with the values that repeat them (theflagskey andFlag.key; avariationskey,Variant.keyandSplit.variationKey).StringCanonicalizer(Introduce a reusable string canonicalizer for FFE parsing #13588: not thread-safe, bounded, dropped when the parse returns) is an open-addressing table of strings and their hashes. This PR first shipped its own copy; it now uses the toolbox one. String values are canonicalized from Jackson's character buffer, so a repeated value never allocates aString. Field names go through the same table.INTERN_FIELD_NAMESis turned off. By default it put flag keys, variation keys and the keys of JSON values, which are customer data, in the JVM-wide string table. Field names are still canonicalized in the parser factory's own symbol table (CANONICALIZE_FIELD_NAMESstays on), which outlives a parse but is bounded in size; theStringCanonicalizersharing of values stays within one parse.Motivation
A parsed configuration stays in the old generation until the next one replaces it. Remote Config only delivers changes, and the CDN source skips the parse on a 304, so in production the configuration is long-lived. Every concurrent marking cycle walks it again, so each duplicate costs memory and marking work for its whole life. Duplicate strings were about a quarter of the retained configuration.
Re-measured with the toolbox
StringCanonicalizer(this branch440016510fagainst its base, #13532 at676974da40; JOL, everything reachable from theServerConfiguration; 3 identical runs each):ufc-config.jsonscalescale-jsonThat's within 0.3 percentage points of the original version below.
Parse (5 rotated forks per build, re-run where steal was uneven): the base, this branch with the toolbox canonicalizer, and the original FFE-local canonicalizer on the same base:
scalescale-jsonscale) and +35% (scale-json) parse time, for 4.5% less allocation per parse and the retained savings above. In a profile, the canonicalizer is about 20% of the parse, mostly comparing a candidate against the stored string and the lookup itself. Part of the gap is steal, which stayed higher on the sharing builds (5–8% against 3%) despite reruns.Measured with this PR's original FFE-local canonicalizer, before it moved to the toolbox one; a re-measurement is queued. That run took this PR's head (
d633d4a341) merged locally onto master62d4d1a14e(only a test-file conflict, resolved by keeping both tests), against master62d4d1a14e. The merge keeps #13486'sMembershipIndexout of the comparison. JDK 21, compressed oops.Footprint (JOL, everything reachable from the
ServerConfiguration), and allocation per parse:ufc-config.json(48 flags)scale(10,030 flags)scale-json(10 flags, large JSON values)regexsuitescalesaving (6,140,224 B) is exactly the duplicate-string total the footprint tool reports for master.scaleis 17,128,816 B and 437,384 objects (−37.6%, −45.8%), and canonical is 104,728 B and 3,256 objects (−42.6%, −44.6%).ScaleSuiteBenchmark(2 forks, alternating with master): bytes per evaluation are identical to master in every case, apart from cases where both sides flip between the same two JIT-dependent values. The sandbox had 6–21% hypervisor steal time, so time deltas under about 7% are unconfirmed.rules-sweep−22%,regex-many−17%,one-of-many−16%,variations−12%,numeric−12%,one-of-small-numbers−12%,json-sizes−11%,json-shapes−9.5%flags−6.7%,semver−5.4%,rules−4.7%,json-values+5.9%one-of,regex,splits,time-windows,wide-context,regex/literalsScaleSuiteLoadBenchmark(6 forks):scalescale-jsonscale-jsonis 23% slower (+13 ms per parse; fork ranges [55.7..57.7] vs [69.2..70.8]), probably from canonicalizing its ~155k strings, most of them inside large JSON variation values. It's a load-time cost, paid when the configuration changes, not per evaluation. Skipping canonicalization inside large JSON values is a possible follow-up.Additional Notes
With Store feature flag configuration lists and maps at their exact size (FFE optimization) #13556 (exact-size lists and maps), the two together take
scaleto 15.02 MB (−39%) and 435,064 objects (−46%), and canonical to 108,008 B (−40%) and 3,236 objects (−45%).Not
String.intern(): the texts include customer data, such asONE_OFuser ids, which shouldn't reach a JVM-wide table.Field names are still canonicalized by Jackson (
CANONICALIZE_FIELD_NAMESstays on); only the JVM-wide interning is off. Nothing indd-openfeaturecompares field names by identity.Tests:
StringCanonicalizerTest: sharing, the copy on a miss, equal hashes ("Aa"/"BB"), empty, non-ASCII and surrogate pairs, growth to 10,000 texts.UniversalFlagConfigParserTest:assertSamefor the keys listed above and for two conditions' attributes, plus escapes, non-ASCII and a 20,000-character value.dd-openfeaturetests pass, includingCanonicalFixtureTestandScaleSuiteTest; Spotless and SpotBugs pass.Independent of Return read-only JSON flag values with exact integers #13484 and Index ONE_OF and NOT_ONE_OF lists when the configuration loads #13486–Hash FFE shards without allocating #13490. Leo's parser PRs touch other parts of
UniversalFlagConfigParser, so expect at most a small rebase. A possible follow-up seeds the table with the strings of the configuration being replaced, so a new version shares unchanged strings with the old one during the swap.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 issueJira ticket: [PROJ-IDENT]
🤖 Generated with Claude Code