apache / apache/maven

[MNG-7659] ComparableVersion cache

Open
#8,793 3 comments 0 reactions 0 assignees View on GitHub
enhancement priority:minor
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

**[Andrzej J.](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=ajarmoniuk)** opened **[MNG-7659](https://issues.apache.org/jira/browse/MNG-7659?redirect=false)** and commented

Tobias Gruetzmacher has raised an issue with Versions Maven Plugin - [Performance issue with many versions/artifacts #869](https://github.com/mojohaus/versions/issues/869), where he points out that we're creating lots of ComparableVersion objects (which happens especially during ArtifactVersion comparison), which affects performance. He proposed creating a simple cache for these objects.

This proved to increase performance in some Versions Maven Plugin jobs almost twofold.

What do you guys think of introducing this to Maven?

The cache should probably be restricted in size (e.g. use LRUMap from commons collections), so that it won't leak memory when used with mvnd.

Simple implementation is here: https://github.com/mojohaus/versions/pull/870

Using LRUMap: https://github.com/mojohaus/versions/pull/893

The cache could alternatively be owned by DefaultArtifactVersion, where the construction of ComparableVersion is taking place.

I'm querying for opinions on this; if this gains approval, I could implement it. Ultimately I'd like to get rid of the ComparableVersion duplicate in Versions Maven Plugin.

---

**Affects:** 3.8.7

Contributor guide

Open the contributing guide

Research direction

Start by reviewing DefaultArtifactVersion and the ComparableVersion construction described in the issue, then compare the linked Versions Maven Plugin implementations. Done requires agreement on the cache owner and bounded policy, with evidence that artifact-version comparison performance improves without unacceptable memory growth.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.