Experimental Performance
Memory Allocation Optimization
Some classes in Minecraft can occupy significant memory space, creating performance issues. The issue is that your computer's processor can only process 64 bytes at a time in its cache line. If an object exceeds this size, it has to be split across multiple lines, which significantly slows down operations.
Chunk Optimization
Chunks in the game originally occupy 80 bytes of memory. Through special optimizations, we were able to move some variables from the Chunk class and redirect all references to them. This allowed us to reduce the chunk size to the optimal 64 bytes, which on some systems speeds up chunk operations up to 4 times!
Block Processing Improvements
Blocks are also resource-intensive objects with a size of 72 bytes. We applied a similar approach: moved some data to a separate BlockInfo class, which reduced the weight of the main class. This not only accelerated block transfers but also prevented situations where some blocks could occupy more than 128 bytes, which would require three cache lines.
Entity Handling
Entities present the greatest optimization challenge - they occupy a full 272 bytes (5 cache lines). No wonder they often cause lag! We managed to reduce this size to 4 cache lines. Further optimization would require significant intervention and could break compatibility with other mods.
Why Doesn't Mojang Do This?
Minecraft developers have implemented similar optimizations in the past, but in recent years they seem to be paying less attention to performance issues. Many classes have significantly grown in size, negatively affecting game speed. Our mod aims to solve this problem.
Optimization Features
Performance improvement is a complex task requiring deep understanding of computer operation. Our approach involves optimizing the game's data structures for more efficient hardware interaction. Although this requires additional calls and memory allocation, the performance gain significantly outweighs these costs.
Experimental Status
Important to understand: this mod is experimental and uses complex optimization methods through class redistribution. It is not recommended to include it in modpacks and report compatibility issues. The project was created as a proof of concept for the possibility of further optimizing Minecraft by reducing class sizes. Although tests showed significant performance improvement, the mod requires further refinement and testing.