Skip to content

Benchmark FFE evaluation on the scale suites - #13485

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 16 commits into
masterfrom
leo.romanovsky/ffe-scale-suite-benchmark
Nov 19, 2026
Merged

gh-worker-dd-mergequeue-cf854d[bot] merged 16 commits into
masterfrom
leo.romanovsky/ffe-scale-suite-benchmark

Conversation

@leoromanovsky

@leoromanovsky leoromanovsky commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

What Does This Do

Adds JMH benchmarks that measure FFE flag evaluation on the opt-in scale and scale-json suites of the shared fixtures, and sets a baseline for master:

  • ScaleSuiteBenchmark evaluates the cases of each case file through the provider and reports time and allocation for each evaluation.
  • ScaleSuiteLoadBenchmark measures how long each suite's configuration takes to parse, and prints the heap that the parsed configuration retains.
  • ScaleSuiteTest runs the same cases in the unit tests, so a change that resolves a large configuration wrongly fails CI instead of only a manual benchmark run.

This is the base of a stack. Three sibling PRs are stacked on it, and each one reports its before/after numbers against the baseline below:

This PR has no change to shipped code. The submodule bump also brings in fixture main commits that add 8 core cases (one time-bounded holdout flag); CanonicalFixtureTest passes on all of them.

Motivation

We need flag evaluation in Java to win a performance-sensitive customer, and this PR is the foundation: a repeatable measurement for every change that follows. The canonical fixtures are small, so they do not show where an evaluation's cost grows with configuration size: list length, allocation count, rule depth, shard count, regex input length, or JSON value size. The suites in DataDog/ffe-system-test-data#78 cover these dimensions at N and N × M, up to JSON values of 4 MB. This PR runs our evaluator over them, so every performance change shows its effect on the same inputs, on the same machine.

Additional Notes

What the benchmark covers.

  • @Param cases holds all 17 case files: scale/flags, numeric, one-of, one-of-many, one-of-small-numbers, regex, regex-many, rules, rules-sweep, semver, splits, time-windows, variations, wide-context, and scale-json/json-shapes, json-sizes, json-values. The fixture evaluation-suites/scale/AGENTS.md describes each one.
  • With index=all, the operations go through the cases of a file in turn, so a row is the unweighted mean over the 2 to 16 cases of the file, and its slowest case dominates it: the json-sizes row is mostly its 4 MB case. A change that targets one case should also report that case with -p index=<n>; the setup prints the index of each case.
  • The setup evaluates every case once, and the teardown again after the measurement. Both throw on a wrong value or reason, a wrong expected serialId, doLog, or split features, an error code, or on an expectation the check does not handle, so a run that resolves a case wrongly fails instead of reporting a number. All 122 cases pass on master, including the sharded ones.
  • ScaleSuiteTest evaluates every case twice in the unit tests, parsing each suite once. It reads the benchmark's @Param list and fails unless that list names every case file of the fixtures.
  • The suites and the test build their settings with TestSettings.of(), so JVM properties and environment variables, such as the span enrichment flag, cannot change the metadata path being measured.
  • The separate evaluation-suites/regex suite (dialect and backtracking cases, not scale/regex above) is not here, because the JDK engine does not finish its backtracking cases. Evaluate feature flag regex conditions in linear time #13487 adds it.

Decisions.

  • Compare JSON numbers by value. master returns JSON integers as Double. Return read-only JSON flag values with exact integers #13484 makes them exact, and the core fixture Add JSON number precision fixture ffe-system-test-data#77 checks the type. Comparing by value lets one benchmark run on every PR in the stack. This check guards the measurement; CanonicalFixtureTest is the conformance check of the types.
  • Measure load as well as evaluation. An index, compiled patterns, or prebuilt JSON values move work to load time. The load benchmark shows that cost next to the evaluation gain. The retained-heap figure is the used heap after a full collection, with and without the parsed configuration, after a first parse that initializes the parser and as the smallest of three samples, so it is approximate (it repeats within a few KB).
  • Pin to the merged fixtures. The submodule points to 508a342 on the fixtures' main, the merge commit of Add opt-in scale, scale-json, and regex evaluation suites ffe-system-test-data#78. Its suites are the same as the PR head the rows below were measured on. The same commit also brings the core layer cases from Add mutually exclusive layer test fixtures ffe-system-test-data#66, which pass in the unit and smoke tests.
  • Keep the fixtures in dd-openfeature. The SDK reads most of the shared fixtures, so the ffe-system-test-data submodule and the vendored experimentation-opt-out cases now live in dd-openfeature/src/test/fixtures/. The smoke tests copy ufc-config.json and evaluation-cases from there. The fixtures are a plain directory, not a testFixtures source set: every reader opens them from disk, and a source set would package the 26 MB submodule into jars, including a published variant of dd-openfeature. Branches stacked on this one need the same path change.
  • Rerun on a fixture change. The jmh task declares the suites as an input, so a repin reruns the benchmarks instead of reporting the task up to date. The input is a file tree, so a checkout without the submodule initialized can still run every other benchmark.
  • No new dependency. The case files are read with jackson-core, which the module already uses.

Baseline on master. AWS workspace, Intel Xeon Platinum 8175M, 16 vCPUs, JDK 21.0.10. JMH AverageTime, 1 fork, 3 warm-up and 5 measurement iterations of 2 s, -prof gc. Each row is the mean over the cases of the file. The time and allocation figures predate the latest commit, which leaves the measured evaluation unchanged; the retained heap uses the revised method. The one-of-small-numbers row and the scale load row were measured later, after the fixtures added that file and its 2 flags; the earlier scale parse time was 95.8 ms, and 2 more flags out of 10,030 do not explain the difference, so treat the parse time as within this machine's run-to-run variation. The json-sizes row and the scale-json load row were measured again after the fixtures replaced the 10 MB value with a 4 MB one, with three forks while the machine was heavily loaded (load average about 70 on 16 vCPUs): their allocation and retained heap are exact, but compare their times only with runs made back to back on the same machine. The one-of, one-of-many, rules, rules-sweep, splits, variations, and wide-context rows were measured again at 911924f, after the fixtures added first-match cases to those files (load average about 15): a row's mean covers the new cases, so compare those rows only with runs on the same pin. One fork suits allocation and large time differences; for a time difference under about 15%, run three forks (-Pjmh.forks=3, or -f 3 with the JMH jar).

Case file Time per evaluation Allocation per evaluation
scale/flags (10,000 flags) 215 ns 330 B
scale/wide-context 662 ns 368 B
scale/time-windows 801 ns 368 B
scale/numeric 2.79 µs 1,968 B
scale/rules 3.34 µs 1,622 B
scale/one-of-small-numbers 12.5 µs 15,424 B
scale/semver 12.8 µs 15,971 B
scale/regex-many 21.0 µs 42,164 B
scale/splits 23.7 µs 33,518 B
scale/rules-sweep 25.7 µs 368 B
scale/variations 58.0 µs 28,068 B
scale/one-of 152 µs 80,428 B
scale/one-of-many 167 µs 393 B
scale/regex 1.82 ms 12,201 B
scale-json/json-values 36.0 µs 63,736 B
scale-json/json-shapes 1.11 ms 3.3 MB
scale-json/json-sizes 5.55 ms 6.9 MB

Through the client's context. The rows above pass the provider one reused context (evaluate). The OpenFeature client passes a new LayeredEvaluationContext on each call instead, and evaluateLayered measures that. It adds 48 B per evaluation for most cases. A rule on id costs much more when the context has no id, because the layered context builds its key set again on each call:

scale/wide-context case evaluate evaluateLayered
scale-id-wide-context, match (index 3) 1.24 µs, 368 B 11.4 µs, 11,296 B
scale-id-wide-context, miss (index 4) 1.12 µs, 368 B 13.9 µs, 11,360 B
Suite Configuration Parse time Allocated by one parse Retained heap
scale 7.8 MB, 10,030 flags 111 ms 90.5 MB 24.2 MB
scale-json 7.7 MB, 10 flags 74.6 ms 64.6 MB 38.2 MB

The stacked PRs address json-*, one-of*, and regex*. The baseline also shows the next candidates. splits allocates 34 KB per call (a new MessageDigest and hex string for each shard). semver allocates 16 KB (the attribute is parsed again for each condition). variations scans 1,000 allocations.

Run all case files, with both evaluation methods:

./gradlew :dd-openfeature:jmh -Pjmh.includes=ScaleSuiteBenchmark,ScaleSuiteLoadBenchmark -Pjmh.profilers=gc

Only the rows of the main table (evaluate), in about half the time:

./gradlew :dd-openfeature:jmh '-Pjmh.includes=ScaleSuiteBenchmark.evaluate$' -Pjmh.profilers=gc

Run one case:

./gradlew :dd-openfeature:jmhJar
java -jar dd-openfeature/build/libs/dd-openfeature-*-jmh.jar ScaleSuiteBenchmark -p cases=scale/splits -p index=0 -prof gc

Contributor Checklist

Jira ticket: [PROJ-IDENT]

@leoromanovsky leoromanovsky added type: feature Enhancements and improvements tag: performance Performance related changes tag: no release notes Changes to exclude from release notes tag: ai generated Largely based on code generated by an AI or LLM comp: openfeature OpenFeature labels Nov 17, 2026
@datadog-datadog-us1-prod

datadog-datadog-us1-prod Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 60.63% (-0.04%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 971fcdf | Docs | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Nov 17, 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 14.02 s 14.03 s [-0.7%; +0.6%] (no difference)
startup:insecure-bank:tracing:Agent 12.95 s 13.01 s [-1.2%; +0.3%] (no difference)
startup:petclinic:appsec:Agent 17.75 s 17.52 s [+0.4%; +2.2%] (maybe worse)
startup:petclinic:iast:Agent 17.52 s 17.67 s [-1.8%; +0.1%] (no difference)
startup:petclinic:profiling:Agent 17.41 s 17.47 s [-1.6%; +1.0%] (no difference)
startup:petclinic:sca:Agent 17.76 s 17.66 s [-0.4%; +1.5%] (no difference)
startup:petclinic:tracing:Agent 16.19 s 16.78 s [-7.7%; +0.7%] (no difference)

Commit: 971fcdf9 · 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.

leoromanovsky and others added 2 commits November 17, 2026 00:47
Add ScaleSuiteBenchmark, which evaluates each case of the opt-in scale suite of the shared FFE fixtures. The setup checks every expected value and reason first. Pin ffe-system-test-data to the scale suite PR head.
The scale benchmark sat on the JSON value change and checked JSON
integers by type, so it could not set a baseline on master. It now
compares JSON numbers by value, covers every case file of the scale and
scale-json suites, can isolate one case with the index parameter, and
prints each case's index. A load benchmark measures parsing each suite's
configuration and prints the heap it retains, so changes that move work
to load time show their cost.

The submodule points to the scale-suite fixture branch, which adds the
N x M dimensions and JSON values up to 10 MB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leoromanovsky
leoromanovsky force-pushed the leo.romanovsky/ffe-scale-suite-benchmark branch from 5a15d5c to c18784a Compare November 17, 2026 00:54
@leoromanovsky
leoromanovsky changed the base branch from leo.romanovsky/ffe-json-frozen-values to master November 17, 2026 00:54
@leoromanovsky leoromanovsky changed the title Benchmark the FFE scale evaluation suite Benchmark FFE evaluation on the scale suites Nov 17, 2026
@leoromanovsky leoromanovsky added the crucible: reviewing A Crucible review has started; this PR has reviewer attention. label Nov 17, 2026 — with ddtool CLI
@leoromanovsky leoromanovsky removed the crucible: reviewing A Crucible review has started; this PR has reviewer attention. label Nov 17, 2026
The scale benchmarks failed the forbidden API check on System.out, and
nothing outside a manual JMH run checked the scale cases, so a sibling
change that resolves a large configuration wrongly would go unnoticed.

- Add ScaleSuiteTest: evaluate every case of the scale and scale-json
  suites twice, and fail when the benchmark misses a case file. The
  cases, their check and the suite reader move to the test sources and
  the benchmarks reuse them; the reader uses JsonReading.
- Allow System.out in the benchmark setups (@SuppressForbidden).
- Check every case again after the measurement, fail on an error code,
  and reject expectations the check does not handle.
- Rerun the jmh task when the fixtures change.
- Measure retained heap after a first parse, as the smallest of three
  signed samples.
- Describe a row as the unweighted mean over the cases of a file, say
  that hooks are not measured and when to run three forks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Contributor Author

Reminder: before merge, repin the fixture submodule to the commit that DataDog/ffe-system-test-data#78 lands as on main, and confirm the scale suites are present there (the checklist item in the description). Two things depend on that order:

Check after the repin:

git -C dd-smoke-tests/openfeature/src/test/resources/ffe-system-test-data fetch origin main
git -C dd-smoke-tests/openfeature/src/test/resources/ffe-system-test-data merge-base --is-ancestor HEAD origin/main && echo on-main
./gradlew :dd-openfeature:test --tests com.datadog.openfeature.ScaleSuiteTest

leoromanovsky added a commit that referenced this pull request Nov 17, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fixture PR now checks that the committed scale files match the
generator and fixes its docs. The case and configuration files are
unchanged, so the benchmark numbers do not change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
leoromanovsky added a commit that referenced this pull request Nov 17, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
leoromanovsky added a commit that referenced this pull request Nov 17, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
leoromanovsky added a commit that referenced this pull request Nov 17, 2026
Brings in ScaleSuiteTest, the benchmark hardening, and the fixtures pin
f425d578. ScaleSuiteTest now also checks the four case files of the
regex suite, so the cross-SDK regex contract runs in CI. ScaleCase
accepts an expected errorCode, so the PARSE_ERROR cases of
unsupported-syntax.json are compared, not skipped. semantics and
unsupported-syntax are checked but not benchmarked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fixtures add a case file with ONE_OF lists of the integers 1 to
1000 and of the powers of two up to 2^52, which an index keyed on exact
doubles must still match. Pin them and benchmark the file; its 8 cases
pass on master.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
leoromanovsky added a commit that referenced this pull request Nov 17, 2026
Brings in the scale/one-of-small-numbers case file and the fixtures pin
08e86993. The benchmark and ScaleSuiteTest keep both the new case file
and the regex suite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
leoromanovsky and others added 4 commits November 18, 2026 15:49
The SDK is the main reader of the ffe-system-test-data submodule and the
only reader of the vendored experimentation opt-out cases, so both move
from the smoke-test resources to dd-openfeature/src/test/fixtures. They
stay outside any source set: the tests and benchmarks read them from
disk, and the smoke tests copy ufc-config.json and evaluation-cases into
their resources.

The jmh task declares the scale suites as a file tree, which is empty
rather than missing when the submodule is not initialized, so a jmh run
on such a checkout no longer fails before it starts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The suites read the system properties and environment, so setting
DD_EXPERIMENTAL_FLAGGING_PROVIDER_SPAN_ENRICHMENT_ENABLED turned span
enrichment on: the benchmarks measured the enriched metadata path and
the expected selection metadata no longer described it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each case file parsed its suite again, 14 times for the 7.8 MB scale
configuration. One provider per suite, shut down after all cases, parses
each configuration once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ScaleSuiteTest compared the fixtures with a copy of the benchmark's
@PARAM list, so a case file missing from the benchmark went unnoticed.
The test now reads the @PARAM by reflection, with the jmh classes on
its runtime classpath.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@mcculls mcculls left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 2 benchmarks look like a reasonable base to build on

leoromanovsky and others added 2 commits November 19, 2026 01:06
Keep the fixtures submodule at dd-openfeature/src/test/fixtures, pinned
to 508a342. Master bumped it at the old smoke-test path to 29ba6bf,
which is 4 commits behind that pin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leoromanovsky
leoromanovsky added this pull request to the merge queue Nov 19, 2026
@dd-octo-sts

dd-octo-sts Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-11-19 02:26:13 UTC ℹ️ Start processing command /merge


2026-11-19 02:26:17 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 1h (p90).


2026-11-19 03:09:38 UTC ℹ️ MergeQueue: This merge request was merged

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 19, 2026
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 4075f1f into master Nov 19, 2026
917 of 919 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the leo.romanovsky/ffe-scale-suite-benchmark branch November 19, 2026 03:09
@github-actions github-actions Bot added this to the 1.70.0 milestone Nov 19, 2026
leoromanovsky added a commit that referenced this pull request Nov 19, 2026
Take master's version of every file from #13485, which merged as a
squash commit, so this branch only carries the shard hashing change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
leoromanovsky added a commit that referenced this pull request Nov 19, 2026
Master has the scale benchmarks of #13485 as one squashed commit, with
the fixtures moved to dd-openfeature/src/test/fixtures. Take master's
benchmarks, fixture path and fixture pin, and drop the old fixture
path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
leoromanovsky added a commit that referenced this pull request Nov 19, 2026
#13485 merged as a squash commit, so the conflicts take master's version of
its files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
leoromanovsky added a commit that referenced this pull request Nov 19, 2026
Takes master's version of every #13485 file; only this branch's SemVer
changes differ from master.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gh-worker-dd-mergequeue-cf854d Bot pushed a commit that referenced this pull request Nov 19, 2026
Benchmark the FFE scale evaluation suite

Add ScaleSuiteBenchmark, which evaluates each case of the opt-in scale suite of the shared FFE fixtures. The setup checks every expected value and reason first. Pin ffe-system-test-data to the scale suite PR head.

Benchmark every scale dimension on master, and the configuration load

The scale benchmark sat on the JSON value change and checked JSON
integers by type, so it could not set a baseline on master. It now
compares JSON numbers by value, covers every case file of the scale and
scale-json suites, can isolate one case with the index parameter, and
prints each case's index. A load benchmark measures parsing each suite's
configuration and prints the heap it retains, so changes that move work
to load time show their cost.

The submodule points to the scale-suite fixture branch, which adds the
N x M dimensions and JSON values up to 10 MB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Index ONE_OF and NOT_ONE_OF lists when the configuration loads

Each ONE_OF or NOT_ONE_OF evaluation scanned its list and compared the
attribute with each element. With a number attribute, the scan also
parsed each element as a double. A 10,000-element list cost about 25 us
for a string attribute and 90 us for a number attribute.

The parser now builds a MembershipIndex for each list of 2 or more
elements: a HashMap for string comparisons and primitive long-keyed
tables for numeric comparisons, each mapping a key to the element's
first position. A lookup costs about 2-4 ns at every list size.

The index gives the same result as the scan, including the numeric
leniency (42 matches "042") and the errors that the scan raises at an
unconvertible element. When a result depends on such an error, or for
an attribute type that the index does not handle, the evaluator runs
the scan as before.

Spread ONE_OF number keys over the table, and test the parser builds the index

The long table hashed with the low bits of a Fibonacci product. A whole
number below 2^21 has a key whose low 32 bits are zero, so small integers
and powers of two all started at slot 0, and a lookup in a list such as
1..1000 walked about 500 slots (792 ns instead of 5 ns). The slot now takes
the high bits of the product, which depend on every bit of the key.

- MembershipIndexTest: start slots of small integers, powers of two, prices
  in cent steps and large IDs; it fails on the old hash.
- UniversalFlagConfigParserTest: the parser builds the index for lists of two
  or more elements, and not for one element.
- FlagEvaluatorMembershipTest: attribute types that the index leaves to the
  scan (Instant, list, map), and nested list and object elements.
- A list without numeric strings shares one table for both number lookups.
- Comments match the code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Check the scale suites in the unit tests and harden the benchmarks

The scale benchmarks failed the forbidden API check on System.out, and
nothing outside a manual JMH run checked the scale cases, so a sibling
change that resolves a large configuration wrongly would go unnoticed.

- Add ScaleSuiteTest: evaluate every case of the scale and scale-json
  suites twice, and fail when the benchmark misses a case file. The
  cases, their check and the suite reader move to the test sources and
  the benchmarks reuse them; the reader uses JsonReading.
- Allow System.out in the benchmark setups (@SuppressForbidden).
- Check every case again after the measurement, fail on an error code,
  and reject expectations the check does not handle.
- Rerun the jmh task when the fixtures change.
- Measure retained heap after a first parse, as the smallest of three
  signed samples.
- Describe a row as the unweighted mean over the cases of a file, say
  that hooks are not measured and when to run three forks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Merge the #13485 base (a887657) into the ONE_OF index branch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Pin the fixtures to the latest head of the scale suite PR

The fixture PR now checks that the committed scale files match the
generator and fixes its docs. The case and configuration files are
unchanged, so the benchmark numbers do not change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Merge the #13485 base (09289ff) into the ONE_OF index branch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Benchmark one-of lists of small numbers

The fixtures add a case file with ONE_OF lists of the integers 1 to
1000 and of the powers of two up to 2^52, which an index keyed on exact
doubles must still match. Pin them and benchmark the file; its 8 cases
pass on master.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Merge the #13485 base (30df999) into the ONE_OF index branch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Benchmark the scale cases with the client's layered context

The OpenFeature client passes the provider a new LayeredEvaluationContext
on each call, while the benchmark reused one MutableContext. A rule on
`id` when the context has no `id` reads the layered context's key set,
which it builds again on each call, so the benchmark did not show what
applications pay for it.

evaluateLayered wraps each case's context the way the client does, as
ExperimentationOptOutBenchmark.evaluateFreshLayeredContext does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Merge the #13485 base (8d0f39c) into the ONE_OF index branch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Merge master (4075f1f) into the ONE_OF index branch

#13485 merged as a squash commit, so the conflicts take master's version of
its files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Test the probe lengths of the number index

The test now replays the inserts and bounds the slots that hits and misses
read, over integers, negative integers, powers of two, cent and .99 prices,
large IDs, and integers mixed with powers of two in one list. The earlier
hash fails six of the seven cases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Index every attribute type, and do not scan when the scan throws

Any number attribute is compared through doubleValue, and any other attribute
as its string, so Instant, List and Map attributes use the index too. Only
an attribute that is neither a string nor a boolean, against a list with a
nested element, still scans: an equal map can print its keys in another
order.

When the scan throws, the index returns the element it throws at, and the
evaluator compares the attribute with that element only, which throws the
same exception. The differential test now also compares the error messages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Use static imports and Javadoc in the membership changes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Keep the ONE_OF string index in flat arrays

The HashMap of strings to first positions held a node and often a boxed
Integer per value. On the scale configuration it added 4.4 MB in about
130,000 long-lived objects that every concurrent mark traces.

A flat open-addressed table, modeled on StringIndex, keeps the strings,
their cached hashes and, only for lists with a number element, their
first positions. Lists without strings or without numbers share one
empty table.

Co-authored-by: Douglas Q Hawkins <douglas.hawkins@datadoghq.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Co-authored-by: leo.romanovsky <leo.romanovsky@datadoghq.com>
gh-worker-dd-mergequeue-cf854d Bot pushed a commit that referenced this pull request Nov 20, 2026
Benchmark the FFE scale evaluation suite

Add ScaleSuiteBenchmark, which evaluates each case of the opt-in scale suite of the shared FFE fixtures. The setup checks every expected value and reason first. Pin ffe-system-test-data to the scale suite PR head.

Benchmark every scale dimension on master, and the configuration load

The scale benchmark sat on the JSON value change and checked JSON
integers by type, so it could not set a baseline on master. It now
compares JSON numbers by value, covers every case file of the scale and
scale-json suites, can isolate one case with the index parameter, and
prints each case's index. A load benchmark measures parsing each suite's
configuration and prints the heap it retains, so changes that move work
to load time show their cost.

The submodule points to the scale-suite fixture branch, which adds the
N x M dimensions and JSON values up to 10 MB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Parse each FFE SemVer attribute once per evaluation

A flag with many SemVer conditions on the same attribute parsed the
attribute value once per condition: the scale-semver-ladder fixture
parses it up to 100 times per evaluation. The parser now marks flags
with SemVer conditions, and their evaluations keep a small cache of
attribute parses, invalid versions included. Other flags allocate
nothing for it.

ParsedSemver.parse no longer copies the core components, the build
metadata or the remainder, and prerelease comparison compares
identifiers in place instead of copying them. Numeric conditions
convert operands to double without boxing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Keep numeric conversion errors identical and place the SemVer tests

Numeric comparisons convert numbers without boxing and send every
other operand through mapValue, so an unconvertible or null operand
still fails with the same exception and message, which reaches
getErrorMessage() when full evaluation data is observed. Tests compare
those messages with mapValue's for a few bad inputs.

Flag.hasSemverConditions documents that only the parser sets it,
before the configuration is published. The parse cache derives its
count from its entries. The ladder tests move into FlagEvaluatorTest
and the parser flag test into UniversalFlagConfigParserTest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Check the scale suites in the unit tests and harden the benchmarks

The scale benchmarks failed the forbidden API check on System.out, and
nothing outside a manual JMH run checked the scale cases, so a sibling
change that resolves a large configuration wrongly would go unnoticed.

- Add ScaleSuiteTest: evaluate every case of the scale and scale-json
  suites twice, and fail when the benchmark misses a case file. The
  cases, their check and the suite reader move to the test sources and
  the benchmarks reuse them; the reader uses JsonReading.
- Allow System.out in the benchmark setups (@SuppressForbidden).
- Check every case again after the measurement, fail on an error code,
  and reject expectations the check does not handle.
- Rerun the jmh task when the fixtures change.
- Measure retained heap after a first parse, as the smallest of three
  signed samples.
- Describe a row as the unweighted mean over the cases of a file, say
  that hooks are not measured and when to run three forks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Pin the fixtures to the latest head of the scale suite PR

The fixture PR now checks that the committed scale files match the
generator and fixes its docs. The case and configuration files are
unchanged, so the benchmark numbers do not change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Test that an evaluation parses each SemVer value once

A test now counts the SemVer parses of one evaluation's rules, so
bypassing the cache fails. New precedence rows cover a numeric
prerelease identifier that is not the last one. Core components use
Long.parseUnsignedLong on the version's range instead of a hand-written
parser. The null-element message test is skipped on JDKs without
helpful NullPointerException messages instead of comparing null with
null, and the toDouble Javadoc states what it converts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Merge the #13485 base (09289ff) into the SemVer parse-once branch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Benchmark one-of lists of small numbers

The fixtures add a case file with ONE_OF lists of the integers 1 to
1000 and of the powers of two up to 2^52, which an index keyed on exact
doubles must still match. Pin them and benchmark the file; its 8 cases
pass on master.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Merge the #13485 base (30df999) into the SemVer parse-once branch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Merge master (#13485 squash 4075f1f) into the SemVer parse-once branch

Takes master's version of every #13485 file; only this branch's SemVer
changes differ from master.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Drop the identity check SpotBugs flags in SemverParseCache

SpotBugs reports ES_COMPARING_PARAMETER_STRING_WITH_EQ for the
`cached == value || cached.equals(value)` fast path. String.equals
already returns early on identity, so the explicit == adds nothing;
scale/semver time and allocation are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Compare SemVer attributes in place instead of caching their parse

An evaluation now validates and compares each SemVer attribute against the
pre-parsed comparand in one pass over the string, without building a
ParsedSemver. This removes the per-evaluation SemverParseCache and the
hasSemverConditions marker on Flag, which only existed to feed that cache.

ParsedSemver.compare(String, ParsedSemver) returns exactly
compare(parse(version), comparand), or INVALID_ORDERING when parse would
reject the version. Tests check that over every pair of the valid, invalid,
spec-ordering and edge-case versions, and over seeded random strings.

Suggested by Doug Hawkins in the review of #13488.

Co-authored-by: Douglas Q Hawkins <douglas.hawkins@datadoghq.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Share SemVer suffix validation and test the in-place compare further

parse and compare(String, ParsedSemver) now validate the prerelease and
build metadata through one helper, so a grammar change lands in one place.
The helper allocates nothing and returns the end of the prerelease.

New tests reject non-ASCII digits in both paths, fuzz the suffixes of
equal cores, check SemVer precedence through the String overload, cover
SEMVER operator edge cases in the evaluator, and catch a truncating
numeric conversion. The javadocs now say the attribute is compared
without allocating rather than in one pass, and describe how null fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Co-authored-by: devflow.devflow-routing-intake <devflow.devflow-routing-intake@kubernetes.us1.ddbuild.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: openfeature OpenFeature tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes tag: performance Performance related changes type: feature Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants