Skip to content

Conversation

@supersaiyansubtlety
Copy link
Member

@supersaiyansubtlety supersaiyansubtlety commented Dec 3, 2025

Supersedes #344

Fixes excessive memory usage introduced in #306 by:

  • making CombinedJarIndex's EntyIndex, ReferenceIndex, and BridgeMethodIndex actual combinations of MainJarIndex's and LibraryJarIndex's indexes
  • removing Enigma's mainReferencedPredicate; it was just wasted overhead since the number of libs classes is tiny
  • BREAKING not running custom indexers over CombinedJarIndex's classes; they already ran over main's and lib's restored: performance is fine with it; avoids breaking indexers that need the combined scope all at once

Implementing proper combining for just EntyIndex and ReferenceIndex was enough to fix performance (I did EntryIndex first, so just ReferenceIndex might be enough); it ran fine before I combined BridgeMethodIndexes.

It's probably possible to combine InheritanceIndexes, too, but it could be considerably more complex and might involve the combined index actually doing some of its own indexing.
Same goes for LambdaIndexes.


BREAKING (maybe*): the combined ReferenceIndex does not currently index references from the main jar to libs; it's just a combination of the main and lib ReferenceIndexes.
*Not sure if this is actually true and not sure how to check.

minor breakage:

  • converts EntyIndex, ReferenceIndex, and BridgeMethodIndex into sealed interfaces with hidden implementations; they're no longer instantiable or extendable by users (probably not intended to be instantiable or extendable anyways)
  • makes CombinedJarIndex final and its constructor private (not intended for extension anyway)

make CombinedJarIndex's EntryIndex a combination of MainJarIndex's and LibrariesJarIndex's
make CombinedJarIndex's ReferenceIndex a combination of MainJarIndex's and LibrariesJarIndex's; does NOT currently index references from main to lib
@supersaiyansubtlety supersaiyansubtlety self-assigned this Dec 3, 2025
@supersaiyansubtlety supersaiyansubtlety added bug Something isn't working backend affects the enigma backend labels Dec 3, 2025
Copy link
Member

@ix0rai ix0rai left a comment

Choose a reason for hiding this comment

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

looks good! we should look into making a test using a heavier jar to catch regressions like this in the future


String getTranslationKey();

// TODO we should probably replace this with a type object in a breaking update
Copy link
Member

Choose a reason for hiding this comment

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

what are you thinking of for the new version?

Copy link
Member Author

Choose a reason for hiding this comment

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

at minimum a Type<I extends JarIndex> object that's used as the key for the indexer
it would also hold the translation key

we could also use it to hide the actual indexing methods from users calling getIndex(Type<...> type):
change JarIndex like:

public interface JarIndex<A> {
  //...
  A getAccess();
  
  record Type<A> {
    //...
  }
}

then getIndex (possibly renamed to accessIndex or smth) would return the access, not the index itself

access types would provide the access methods like EntryIndex::getParameters but hide the indexing methods like EntryIndex::indexMethod

Copy link
Member

Choose a reason for hiding this comment

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

nice, i love that idea of keeping things better isolated

@supersaiyansubtlety supersaiyansubtlety marked this pull request as ready for review December 12, 2025 21:49
@supersaiyansubtlety
Copy link
Member Author

forgot to de-draft earlier, de-drafted now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend affects the enigma backend bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants