Skip to content

Glacier#221

Draft
contariaa wants to merge 1 commit intoMinecraft-Java-Edition-Speedrunning:mainfrom
contariaa:glacier/initial-release
Draft

Glacier#221
contariaa wants to merge 1 commit intoMinecraft-Java-Edition-Speedrunning:mainfrom
contariaa:glacier/initial-release

Conversation

@contariaa
Copy link
Copy Markdown
Member

Glacier is an optimization mod with a main focus on worldgen performance and memory usage.

https://github.com/contariaa/glacier

Features

(as organized in the mixin package)

Allocation Optimizations:

  • reduce BlockPos allocations by using BlockPos.Mutable instead
  • reuse more objects in Carver recursion
  • reduce allocations Direction.values() by reusing a cached array
  • don't allocate iterators for empty structure maps

Misc Chunk Loading Optimizations:

  • a few small optimizations to chunk loading

World Gen Optimizations:

  • skip sampling biome layers that don't affect the final result
  • Lithium has a similar optimization but does it on a far smaller scale, so we disable that via our fabric.mod.json
  • a few small optimizations to reduce block state/fluid state lookups
  • a few small optimizations to noise calculation

Lazier DFU:

  • instead of just lazily initialising rules, the entire building process is done lazily
  • wraps LazyDFU so no breakage there

Memory Optimizations:

  • reduce biome array memory usage
    • biome arrays usually contain one or a few different biomes, so we can save a lot of memory by implementing a paletted view
  • reduce carving mask memory usage/allocation rate
    • proto chunks allocate two BitSets covering the entire chunk, eventhough most of the chunk is usually not affected by carving, so we implement 16 lazily created BitSets in a trench coat
  • lazily initialise ChunkSections during worldgen
    • Minecraft's chunks are built to lazily initialize ChunkSections, however during noise population Minecraft creates all of them, this optimization prevents that
  • avoid creating a bunch of empty collections for entity lists and structure references in chunks that have none
  • deduplicate empty arrays in a few data-driven places
  • use dummy goal selectors and mob navigation on client, since entities don't actually use them
  • deduplicate empty minecraft itemstacks when parsing from entity nbt
  • deduplicate "minecraft" namespace in identifiers
  • deduplicate certain default property classes in models
  • reduce structure template memory usage
    • structure templates are saved as a list of all its blocks, their positions and block data, we can save a lot of memory by compressing coordinates and paletting blocks into a long array, which is transformed into a mutable StructureBlockInfo on iteration
  • trim lists in various places

Notes

The most impactful optimizations in Glacier are the allocation optimizations, skipping biome layer sampling, compressed biome arrays and compressed structure templates.
Compressed structure templates were also copied (in a modified way) into Structure Layout Optimizer, a mod I think is worth testing for legalization too. It has a 1.16.1 version that TelepathicGrunt kindly made at my request.
Memory profiling for glacier was done with FerriteCore installed to not work on duplicate optimizations, I have a port of FerriteCore 7.0.0 for 1.16.1 from a while ago locally, I will get that organized so we can test it's impact aswell in the future.

@contariaa contariaa changed the title Glacier 0.6.0-beta.1 Glacier Feb 10, 2026
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.

1 participant