Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
92ed06e
Benchmark the FFE scale evaluation suite
leoromanovsky Nov 17, 2026
c18784a
Benchmark every scale dimension on master, and the configuration load
leoromanovsky Nov 17, 2026
2999aae
Index ONE_OF and NOT_ONE_OF lists when the configuration loads
leoromanovsky Nov 16, 2026
80d40d7
Spread ONE_OF number keys over the table, and test the parser builds …
leoromanovsky Nov 17, 2026
a887657
Check the scale suites in the unit tests and harden the benchmarks
leoromanovsky Nov 17, 2026
3a5d6ae
Merge the #13485 base (a887657) into the ONE_OF index branch
leoromanovsky Nov 17, 2026
09289ff
Pin the fixtures to the latest head of the scale suite PR
leoromanovsky Nov 17, 2026
d322076
Merge the #13485 base (09289ff) into the ONE_OF index branch
leoromanovsky Nov 17, 2026
30df999
Benchmark one-of lists of small numbers
leoromanovsky Nov 17, 2026
abc44b2
Merge the #13485 base (30df999) into the ONE_OF index branch
leoromanovsky Nov 17, 2026
8d0f39c
Benchmark the scale cases with the client's layered context
leoromanovsky Nov 17, 2026
a9a18e6
Merge the #13485 base (8d0f39c) into the ONE_OF index branch
leoromanovsky Nov 17, 2026
fe39002
Merge master (4075f1f) into the ONE_OF index branch
leoromanovsky Nov 19, 2026
2b281f6
Test the probe lengths of the number index
leoromanovsky Nov 19, 2026
a114d9f
Index every attribute type, and do not scan when the scan throws
leoromanovsky Nov 19, 2026
2c35358
Use static imports and Javadoc in the membership changes
leoromanovsky Nov 19, 2026
3edfb47
Keep the ONE_OF string index in flat arrays
leoromanovsky Nov 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.datadog.openfeature.internal.ufc.ConditionOperator;
import com.datadog.openfeature.internal.ufc.Feature;
import com.datadog.openfeature.internal.ufc.Flag;
import com.datadog.openfeature.internal.ufc.MembershipIndex;
import com.datadog.openfeature.internal.ufc.ParsedSemver;
import com.datadog.openfeature.internal.ufc.Rule;
import com.datadog.openfeature.internal.ufc.ServerConfiguration;
Expand Down Expand Up @@ -318,9 +319,9 @@ private static boolean evaluateCondition(
case NOT_MATCHES:
return !matchesRegex(attributeValue, condition);
case ONE_OF:
return isOneOf(attributeValue, condition.value);
return isOneOf(attributeValue, condition);
case NOT_ONE_OF:
return !isOneOf(attributeValue, condition.value);
return !isOneOf(attributeValue, condition);
case GTE:
return compareNumber(attributeValue, condition.value, (a, b) -> a >= b);
case GT:
Expand Down Expand Up @@ -357,7 +358,26 @@ private static boolean matchesRegex(
return pattern.matcher(String.valueOf(attributeValue)).find();
}

private static boolean isOneOf(final Object attributeValue, final Object conditionValue) {
private static boolean isOneOf(
final Object attributeValue, final ConditionConfiguration condition) {
// Parsed configurations index lists of two or more elements; the index gives the same result
// as the scan.
final MembershipIndex membership = condition.membership;
if (membership != null) {
final int result = membership.lookup(attributeValue);
if (result > MembershipIndex.SCAN) {
return result == MembershipIndex.MATCH;
}
if (result < MembershipIndex.SCAN) {
// No earlier element matches, so the comparison with this element throws as the scan does.
final Object element = ((List<?>) condition.value).get(MembershipIndex.throwsAt(result));
return valuesEqual(attributeValue, element) || scanOneOf(attributeValue, condition.value);
}
}
return scanOneOf(attributeValue, condition.value);
}

private static boolean scanOneOf(final Object attributeValue, final Object conditionValue) {
if (!(conditionValue instanceof Iterable)) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ public final class ConditionConfiguration {
// The validated MATCHES/NOT_MATCHES pattern, prepared when the configuration is parsed.
public transient Pattern regex;

/**
* The ONE_OF/NOT_ONE_OF hash index, built when the configuration is parsed; null for one-element
* lists and for configurations that are not parsed.
*/
public transient MembershipIndex membership;

public ConditionConfiguration(
final ConditionOperator operator, final String attribute, final Object value) {
this.operator = operator;
Expand Down
Loading
Loading