Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-dev] Improving m2e performance



On Mon, Jun 7, 2021 at 8:58 AM Carsten Pfeiffer <carsten.pfeiffer@xxxxxxxx> wrote:
- making the project cache more effective by building projects in an order such that often used (parent) projects are built first and remain in the cache
- avoiding project building altogether when not necessary
- trying to reuse MavenProject instances more

The cache can indeed be improved in many ways such as the ones you mention here. Building projects is often performing as O(n^2) becauseof this cache.
Such improvements would be welcome in m2e; they're indeed infinitely more profitable than growing the cache size (although increasing the cache size a bit, eg from 5 to 20, would be acceptable given nowadays RAM availability compared to 12 years ago, and it brings noticeable performance boost; maybe the size of the cache could even be made elastic according to available heap size).
One important pitfall of the cache is that if you build parent and parent/child/grandchild/grandgrandchild with same build options (profiles and so on), then you typically only need to build grandgrandchild and then the cache will contain a MavenProject for the whole hierarchy. However the "nested" projects are currently not accessible through cache, so if you build grandgrandchild and then ask for the MavenProject of parent, then a new MavenProject is built instead of reusing the parent; and -usually- another MavenProject is discarded and removed from cache instead. Instead of doing a 1-1 mapping between a pom file and a MavenProject; a build session is actually a *-* mapping. If the cache could be optimized to support that concept, we could then focus on building the "leaves" of the tree and cache them, and with that we'd get only a few items in cache, that would cover a big part of the tree.

@Carsten Do you plan to submit some of those optimizations as PRs to m2e?

Working on optimizing this cache is difficult, but it's extremely valuable and it's extremely fun, there is room for very rewarding improvements. I can only recommend anyone interested to look into it when available!

Back to the top