Skip to content

Optimize artifact lookup in DefaultProjectDependencyAnalyzer#270

Open
sanjana2505006 wants to merge 1 commit intoapache:masterfrom
sanjana2505006:perf/optimize-artifact-lookup
Open

Optimize artifact lookup in DefaultProjectDependencyAnalyzer#270
sanjana2505006 wants to merge 1 commit intoapache:masterfrom
sanjana2505006:perf/optimize-artifact-lookup

Conversation

@sanjana2505006
Copy link

@sanjana2505006 sanjana2505006 commented Feb 2, 2026

While reviewing the core analysis logic, I noticed a performance bottleneck in DefaultProjectDependencyAnalyzer. \n\nPreviously, it used a linear search to find which artifact a class belongs to ($O(N)$ for every class usage), which could be a bottleneck in large projects with many dependencies. These changes switch to a Map-based lookup ($O(1)$) and modernize the code using computeIfAbsent and more robust scope checks.\n\nThis significantly improves the efficiency of the analysis process for projects with large dependency trees.

@sanjana2505006
Copy link
Author

Hello @slawekjaranowski, I’ve opened a PR with a small improvement I noticed.
Whenever you have time, I’d appreciate your thoughts on whether this approach makes sense.
Thank you!

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.

1 participant