Skip to content

Intern SlsVersionMatcher#1349

Open
alongouldman wants to merge 5 commits into
developfrom
intern-orderable-version-and-matcher
Open

Intern SlsVersionMatcher#1349
alongouldman wants to merge 5 commits into
developfrom
intern-orderable-version-and-matcher

Conversation

@alongouldman
Copy link
Copy Markdown

@alongouldman alongouldman commented Apr 19, 2026

==COMMIT_MSG==

Before this PR

When loading releases, I saw a big memory consumption by these objects:

#1  LinkedHashMap$Entry                   178M instances   10.0 GB
  #2  byte[]                                207M instances    6.8 GB
  #3  String                                207M instances    6.6 GB
  #4  HashMap$Node[]                         31M instances    4.8 GB
  #5  LinkedHashMap                          36M instances    3.2 GB
  #6  ImmutableOrderableSlsVersion           46M instances    2.6 GB 
  #7  ImmutableSlsVersionMatcher             22M instances    1.4 GB  ← version matchers

we can't intern OrderableSlsVersion, but at least we can intern VersionMatcher!

After this PR

Intern VersionMatcher, so that it won't consume a lot of memory, if it's the same object.

==COMMIT_MSG==

Possible downsides?

@changelog-app
Copy link
Copy Markdown

changelog-app Bot commented Apr 19, 2026

Generate changelog in changelog/@unreleased

Type (Select exactly one)

  • Feature (Adding new functionality)
  • Improvement (Improving existing functionality)
  • Fix (Fixing an issue with existing functionality)
  • Break (Creating a new major version by breaking public APIs)
  • Deprecation (Removing functionality in a non-breaking way)
  • Migration (Automatically moving data/functionality to a new system)

Description

Intern SlsVersionMatcher

Check the box to generate changelog(s)

  • Generate changelog entry

@alongouldman alongouldman changed the title [intern version matcher intern version matcher Apr 19, 2026
@alongouldman alongouldman changed the title intern version matcher Intern version matcher Apr 19, 2026
@alongouldman alongouldman changed the title Intern version matcher Intern SlsVersionMatcher Apr 19, 2026
@changelog-app
Copy link
Copy Markdown

changelog-app Bot commented Apr 19, 2026

Successfully generated changelog entry!

Need to regenerate?

Simply interact with the changelog bot comment again to regenerate these entries.


📋Changelog Preview

💡 Improvements

  • Intern SlsVersionMatcher (#1349)

.thenComparing(SlsVersionMatcher::getMinorVersionNumber, EMPTY_IS_GREATER)
.thenComparing(SlsVersionMatcher::getPatchVersionNumber, EMPTY_IS_GREATER);

private static final Interner<SlsVersionMatcher> interner = Interners.newWeakInterner();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given this is an immutables object, could you try using @Value.Style(weakInterning = true) ??

https://immutables.github.io/immutable.html#instance-interning

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