Can you improve Minecraft's performance by better multi-threading?
6 hours ago, NvidiaFirePro6900XXTX3DPRO said:It might be using all of my cores when generating chunks, but that is the physical multithreading. I am talking about the multithreading that is software sided. Windows just scales all the workload to different cores, but it's the program's job to be better optimized and assign different threads for different jobs.
That is really hard even though it sounds deceptively simple. You first have to identify whether multithreading is the actual bottleneck. Then you need to investigate if you even can paralellise the workload in the first place and how. The latter is often nontrivial to do properly because you need to think about memory usage, disk I/O, overhead from the threads etc. as well. Regarding the assignment of jobs to cores, in my experience with multithreaded stuff, generally if you think you can schedule smarter than the system, think again unless you know of specific optimisations for your problem. If you do it wrong and the threads end up being in each other's way too much it doesn't help in the best case and makes it slower than not multithreading at all in the worst case.
While a single problem may seem parallelisable, like maybe chunk loading, with complex things like games there is the other problem that that one problem is not the only thing that can multithread or wants your cores. Even in a utopia where everything multithreads perfectly and your CPU would be constantly pegged at 100% no matter what, you would still have the scheduling problem of who gets how much and when to do what.
6 hours ago, NvidiaFirePro6900XXTX3DPRO said:I don't know what that threaded part means. I mean, there is still no "multi-threaded" option, right?
Usually threaded is synonymous with multithreaded in my experience, I would assume so here as well.
6 hours ago, NvidiaFirePro6900XXTX3DPRO said:One more part that shows that multithreading can definitely improve performance is that if I play my world on a server, there is very little or no lag. This is because there is some part of actual multithreading happening here, except that fact that the other thread is running on the server, not your local machine.
Since you and the server are two separate machines it is a bit different from multithreading and does not immediately proof that more multithreading would solve local performance issues. You'd have to dissect what the server does and what the client does and then assess what kind of performance impact it would have if you machine would have to do everything.
6 hours ago, NvidiaFirePro6900XXTX3DPRO said:And porting the game to different systems wouldn't take much effort.
Not really true. Maybe a bit of an extreme example, but just look at console games that come to PC, even the recent ones, and the absolute garbage performance that they sometimes (dare I say often) have. Compare that to something like DOOM 2016 or Eternal that (proverbially) run on just about anything and you can see that doing it right takes effort and knowledge of the system you are porting it to and that you can't always just plonk it down somewhere else and expect it to work with minimal updates or changes.
7 hours ago, NvidiaFirePro6900XXTX3DPRO said:Also, we have optifine from over 10 years, but Mojang has never stepped and done it themselves. Although I don't know if it was because of legal issues, being lazy, not caring and focusing on updates, or just not being able to achieve it. I can understand about chunk loading lag, what about the general optimization of fps? Even when everything is stable, the GPU is under 50% and fps is totally trashed.
Profit-driven incentives aside, there is another side to this I think. A modder or small modding team can focus entirely on the single thing that that mod is supposed to do. Optifine didn't have to develop the game, it had a stepping stone of what was there and could focus entirely on optimising that and had all the time in the world to waste on that single aspect. Meanwhile Mojang has to run the studio, support the game, think of what to do next for their game along their vision, develop those next ideas etc. They have a thousand more things to worry about than a modder. The GPU not being maxed out means that it doesn't get sent more data to process, which means the CPU is one way or another at its limit of what it can send to the GPU. If there are unused cores on the CPU, then you go full circle back to the original question whether CPU power is the actual bottleneck and if/how more parallellisation is even possible.
7 hours ago, NvidiaFirePro6900XXTX3DPRO said:But generating chunks and moving in the world are completely different tasks. Most games do this. No matter how bad your CPU is and how complex the map is, even if your CPU is pegged at 100% usage, it still won't stutter when loading the other parts of the map. Because they are completely separated from the thread that the other part of the game is running on. For example GTA 5, if your CPU is extremely trash, and if you travel too fast, the textures won't even load in time and map can start disappearing because it's not being loaded in real time. This should not be possible if the whole game was running on a single thread, where the game should stutter so much that it would just stop before the map was totally visible and clearly loaded.
but is that what you want? Do you want the game to break and softlock/kill you because you fell through the world,? Or do you want the game to allow itself to catch up and make sure things load properly? This is exactly one of those core problems. In one case people will complain about pop ins and the world breaking, in the other case people will complain about poor performance and stutteryness. There is no win and both are a crap experience only with the former resulting in a few more laughs maybe. And if the CPU is maxed out at 100% then it is doing all it can to try and keep up with the demand. If in the worst case that demand of game logic, loading, rendering etc exceed what the CPu can do then threaded or not it will stutter or freeze anyway.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now