Skip to content

Improve Inherited Context Lookup in getConfigResources #11048

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

he1l0world
Copy link
Contributor

@he1l0world he1l0world commented Jun 17, 2025

Description

This PR improves the performance and clarity of the getConfigResources method in the ModuleDefinitionSet class.

Previously, getConfigResources traversed 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:

  • Get feedback on the approach.
  • Make sure it aligns with broader architectural expectations.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

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

@DaanHoogland
Copy link
Contributor

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.

Copy link

codecov bot commented Jun 17, 2025

Codecov Report

Attention: Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.

Project coverage is 16.60%. Comparing base (f8c4121) to head (286f87a).

Files with missing lines Patch % Lines
.../module/model/impl/DefaultModuleDefinitionSet.java 94.11% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main   #11048   +/-   ##
=========================================
  Coverage     16.60%   16.60%           
  Complexity    13925    13925           
=========================================
  Files          5730     5730           
  Lines        508254   508262    +8     
  Branches      61789    61789           
=========================================
+ Hits          84387    84393    +6     
- Misses       414431   414433    +2     
  Partials       9436     9436           
Flag Coverage Δ
uitests 3.93% <ø> (ø)
unittests 17.49% <94.11%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@he1l0world
Copy link
Contributor Author

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.

Sure!

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