3 ms·
To be honest, a lot of people have slammed the Minecraft codebase, claiming it's badly written and kind of a slow mess. I can't recall the citations, but based
by pnathan 11y ago
To be honest, a lot of people have slammed the Minecraft codebase, claiming it's badly written and kind of a slow mess. I can't recall the citations, but based on the discussions when I read those aspects, I wouldn't put aspersions on Java alone in this case.
- looki 11y agoI remember reading a blog post where somebody talked about how they severely decreased Minecraft's performance after refactoring and replacing function calls with separate X, Y and Z parameters to using a single Position object, which would of course in many instances have to be allocated on the fly. I can't seem to find it anymore, though.
- wtallis 11y agoYes, something that should have at a minimum caused no harm to performance (and possibly helped, such as by allowing for SIMD) and been a win for code readability instead introduced an extra layer of pointer chasing and heap allocation, because Java doesn't have structs. See https://news.ycombinator.com/item?id=8485180 https://news.ycombinator.com/item?id=8485180
- mike_hearn 11y agoIndeed. They are adding value types though. It'll take years but once done, this kind of problem shouldn't crop up again. They've also been doing work on better escape analysis. The JVM can do a lot of optimisations C++ apps don't benefit from, but I think the loss from not having value types more than drowns them out.
- looki 11y agoThat's the one, thank you.
- Macha 11y agoIt was a one-man hobby project turned into one of the biggest video games. I doubt many codebases would work well after growing so far past their original aspirations.
- TazeTSchnitzel 11y agoIt was never well-written, though. It was good enough to work, but it was never good code.
- JustSomeNobody 11y agoBut it got the job done. That means way more than whether he used a factory or not.
- squeaky-clean 11y agoI remember when I played it, there were many mods that optimized the game, usually offering over a 10x speedup with no noticeable difference in graphics or detail. I definitely think that most of the speed increase is coming from the fact that Minecraft is being rewritten, and not which language it's being rewritten in.
- Teckla 11y agoVersion 1.0 is always more sloppy than version 2.0, because with version 2.0, you have the luxury of 20/20 hindsight.
- JustSomeNobody 11y agoSometimes you just have to get things done. The world probably wouldn't have Minecraft if the author had worried about "the proper way to architecture java code" that he read on some ranty blog somewhere.