Skip to content

perf: empty default for ProviderEvaluation#1970

Merged
toddbaert merged 1 commit into
open-feature:mainfrom
tobias-ibounig-dt:perf/pr-7-empty-default
Jun 19, 2026
Merged

perf: empty default for ProviderEvaluation#1970
toddbaert merged 1 commit into
open-feature:mainfrom
tobias-ibounig-dt:perf/pr-7-empty-default

Conversation

@tobias-ibounig-dt

@tobias-ibounig-dt tobias-ibounig-dt commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

This PR

  • Use ImmutableMetadata.EMPTY singleton as the default value for ProviderEvaluation.flagMetadata

Related Issues

None

Notes

Every ProviderEvaluation built without explicit metadata allocated a fresh empty ImmutableMetadata instance via @Builder.Default. Reusing the existing ImmutableMetadata.EMPTY singleton is safe because the class has no mutation methods, and FlagEvaluationDetails already uses the same singleton as its default.

Metric benchmark.txt main This PR Delta vs main
run:+totalAllocatedBytes 139,359,040 107,492,056 103,292,056 −4,200,000 (−3.9%)
run:+totalAllocatedInstances 4,452,140 2,228,290 2,109,848 −118,442 (−5.3%)

Follow-up Tasks

  • More PRs with memory improvements
  • Update benchmark.txt after all are applied

Summary by CodeRabbit

Release Notes

This release includes internal optimizations with no user-facing changes.

  • Chores
    • Optimized initialization of default metadata values for improved efficiency.

Signed-off-by: Tobias Ibounig <tobias.ibounig@dynatrace.com>
@tobias-ibounig-dt tobias-ibounig-dt requested review from a team as code owners June 19, 2026 11:38
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ab77aba4-9f05-40c8-9cf5-b5bfd459f2c0

📥 Commits

Reviewing files that changed from the base of the PR and between cc837b1 and 85b2313.

📒 Files selected for processing (1)
  • src/main/java/dev/openfeature/sdk/ProviderEvaluation.java

📝 Walkthrough

Walkthrough

In ProviderEvaluation<T>, the Lombok @Builder.Default value for the flagMetadata field is changed from ImmutableMetadata.builder().build() to the pre-existing ImmutableMetadata.EMPTY constant.

Changes

Default flagMetadata initialization

Layer / File(s) Summary
flagMetadata default value
src/main/java/dev/openfeature/sdk/ProviderEvaluation.java
The flagMetadata field's @Builder.Default value is switched from constructing a new empty ImmutableMetadata instance to referencing the shared ImmutableMetadata.EMPTY constant.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: using an empty default singleton for ProviderEvaluation's flagMetadata field instead of creating new instances.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.10%. Comparing base (cc837b1) to head (85b2313).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1970      +/-   ##
============================================
+ Coverage     92.11%   93.10%   +0.98%     
- Complexity      660      663       +3     
============================================
  Files            59       59              
  Lines          1624     1624              
  Branches        182      182              
============================================
+ Hits           1496     1512      +16     
+ Misses           80       66      -14     
+ Partials         48       46       -2     
Flag Coverage Δ
unittests 93.10% <ø> (+0.98%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@toddbaert toddbaert merged commit 7f92622 into open-feature:main Jun 19, 2026
12 checks passed
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants