Improve Inherited Context Lookup in getConfigResources - #11048
he1l0world wants to merge 10 commits into
Conversation
|
good initiative @he1l0world , let’s wait till we have #11042 merged with further work on this one. It would be interesting to see if any positive performance impact is given on startup, by this change. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #11048 +/- ##
=========================================
Coverage 19.77% 19.78%
- Complexity 19989 19995 +6
=========================================
Files 6371 6371
Lines 575899 575908 +9
Branches 70495 70495
=========================================
+ Hits 113912 113946 +34
+ Misses 449563 449533 -30
- Partials 12424 12429 +5
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:
|
Sure! |
There was a problem hiding this comment.
Pull request overview
This PR optimizes Spring module context loading by memoizing inherited (parent-chain) context resources in DefaultModuleDefinitionSet#getConfigResources, reducing repeated hierarchy traversal during module initialization.
Changes:
- Introduced an internal cache (
configResourcesMap) to memoize inherited/inheritable context resources per module. - Refactored inherited-resource collection into a helper method (
collectInheritedResources) and simplified array creation.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi @he1l0world is this PR still in progress? Can you please address the review comments? |
|
@he1l0world are you still interested in this? |
Sorry, I missed the message. Yes, I think the comments make sense will address them. |
Yes will update the PR |
There was a problem hiding this comment.
🟢 Approval recommended
The change is localized, preserves prior ordering semantics, and the new memoization is consistent with existing module wiring and lifecycle usage.
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0 new
- Review effort level: Lite
There was a problem hiding this comment.
🟡 Changes recommended
The new memoization cache is backed by an unsynchronized HashMap mutated from a public method, which can introduce concurrency hazards compared to the previous stateless traversal.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
|
@blueorangutan package |
|
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19151 |
|
@blueorangutan test |
|
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-16960)
|
DaanHoogland
left a comment
There was a problem hiding this comment.
clgtm, much more elegant, but also functionally equivilant.
Description
This PR improves the performance and clarity of the
getConfigResourcesmethod in theModuleDefinitionSetclass.Previously,
getConfigResourcestraversed the entire module hierarchy on each call, redundantly re-computing inherited context resources from parent modules. This change introduces memoization using a configResourcesMap. The result is a more efficient and maintainable implementation, especially as the number of modules grows.The work builds upon PR #11042, which added unit test coverage for this method. With tests in place, this change now optimizes the implementation while maintaining the same expected behavior.
I’m submitting this PR in draft form to:
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
Verified using the unit tests introduced in PR #11042
How did you try to break this feature and the system with this change?
Verified that duplicate traversal across inherited modules no longer occurs