Skip to content

Rule speedup through dependency resolution caching #934

@Stephan202

Description

@Stephan202

New feature, improvement proposal

We have a large multi-module build with quite a number of built-in and extra enforcer rules enabled. For modules with many dependencies, plugin execution takes several seconds, adding up to hundreds of seconds over-all. Based on some profiling, most time is spent repeatedly collecting dependency information:

Image

I had a brief look at the code, and besides full rule caching it appears that dependency resolution isn't cached. Would it be possible to add this, such that distinct rules applied to the same module can reuse invariant dependency information?


I suppose that the changes in #930 could be extended to support more fine-grained caching (AbstractResolveDependencies#collectProjectDependencies() would be an easy candidate), but SessionData's documentation explicitly states:

Unlike a cache, this session data is not subject to purging. For this same reason, session data should also not be abused as a cache (i.e. for storing values that can be re-calculated) to avoid memory exhaustion.

There's also EnforcerRuleHelper#getCache(String key, Supplier<?> producer), but EnforcerRuleHelper is deprecated.

I can't promise to have time in the near feature to help implement any improvement in this area, but if one were to attempt this, what would be the recommended approach?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions