3 ms·
> avoiding angering the garbage collector by repeatedly allocating and deallocating stuff One of the places where I believe the Minecraft code falls down hard
by zimpenfish 4y ago
> avoiding angering the garbage collector by repeatedly allocating and deallocating stuff
One of the places where I believe the Minecraft code falls down hard - it allocates and deallocates tens (maybe hundreds) of MB per second. Basically the kind of "first draft you'd write before optimising things" code.
Things like OptiFine help out by (IIRC) making certain things mutable and cutting down the alloc/reallocs.
> Performancewise java actually isn't bad.
Yeah, I should probably clarify that I don't think Java itself is bad but the way Minecraft uses Java and how Microsoft have put basically zero effort into optimising things (because their cash cow - Bedrock - is written in C++) since they've owned it.
When mods like OptiFine and Sodium that are monkey-patching the bytecode can improve things greatly, it's a strong sign the base is not optimised.