perf: return ImmutableContext.EMPTY when merging two empty contexts#1973
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthrough
ChangesImmutableContext EMPTY singleton short-circuit
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1973 +/- ##
============================================
+ Coverage 92.21% 93.20% +0.98%
- Complexity 666 670 +4
============================================
Files 59 59
Lines 1631 1633 +2
Branches 185 186 +1
============================================
+ Hits 1504 1522 +18
+ Misses 80 66 -14
+ Partials 47 45 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Signed-off-by: Tobias Ibounig <tobias.ibounig@dynatrace.com>
c7ea4db to
1d4609c
Compare
|



This PR
ImmutableContext.merge()returnsImmutableContext.EMPTYwhen boththisand the overriding context are emptyRelated Issues
None
Notes
When merging two empty contexts the previous code still allocated a new
ImmutableContext(viathis.asUnmodifiableMap()). The result is always semantically equivalent toEMPTY, so we can return the existing singleton directly.This path is not exercised by the current benchmark workload, so no allocation numbers are provided.
Follow-up Tasks