Skip to content

Conversation

PaintNinja
Copy link
Contributor

  • Use Map.entry() instead of Pair.of() as the former tells Java it will never be null and never be changed.
  • Use Map.ofEntries() instead of HashMap for the same reason. Reduces memory usage and improves performance by letting the map be exactly sized and strongly immutable.
  • Use the deferred class idiom instead of a couple of mutable fields. Allows the map to be stored in a static final and skips the need for an init check. Static finals are faster to load than normal static fields.

- Use `Map.entry()` instead of `Pair.of()` as the former tells Java it will never be null and never be changed.
- Use `Map.ofEntries()` instead of HashMap for the same reason. Reduces memory usage and improves performance by letting the map be exactly sized and strongly immutable.
- Use the deferred class idiom instead of a couple of mutable fields. Allows the map to be stored in a static final and skips the need for an init check. Static finals are faster to load than normal static fields.
@PaintNinja PaintNinja changed the title [1.20] Optimise BiomeConfig [1.20.1] Optimise BiomeConfig Jun 10, 2025
@TheBv TheBv merged commit 0db495b into AlexModGuy:1.20 Aug 5, 2025
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