5 ms·
Every time multi-threading gets brought up one of the devs explains that being single threaded isn't the bottleneck. It is the cpu cache that is the bottleneck.
by Twinklebreeze 6y ago
Every time multi-threading gets brought up one of the devs explains that being single threaded isn't the bottleneck. It is the cpu cache that is the bottleneck.
- foota 6y agoDon't modern processors have more cache available between all cores than available to a single core?
- jayd16 6y agoThey must mean its memory I/O bound.
- foota 6y agoI think they meant it only runs quickly enough when everything's in cache? But that doesn't make much sense to me. It's really hard for me to believe it'd be I/O bound though, when memory bandwidth is like tens+ of gigabytes per second?
- imtringued 6y agoIO bound can also mean that memory latency is a problem. It's not difficult to believe that DF is doing lots of pointer chasing.
- ViViDboarder 6y agoDoes that sound right? Do I have this wrong: there is too much to cache so some of the memory goes to RAM or disk where loading will take longer than cache. You could move some of the loading to another thread so that the UI (text or otherwise) can continue while other data in the backend is moved around between cache, RAM, and disk, and then processed before sending to the interface.
- genocidicbunny 6y agoAnd if it was written with a single thread in mind (which it most likely has been) naively 'multi-threading' it will likely not help do much except increase the number of bugs. Too many independent but intertwined systems communicating with each other. Making DF use multiple cores efficiently would be amazing, but I have serious doubts its viable in the short-ish term without a significant rewrite. The most you're likely to see is some peripheral systems offloaded onto background threads when possible. My hope is that with the upcoming Steam release they make enough money to hire another veteran game programmer or two to help them work on game and make it perform better.
- rhn_mk1 6y agoIsn't (a large part of) DF basically a huge cellular automaton? That problem is already solved for multiple threads.
- genocidicbunny 6y agoIn a lot of ways, yes it is. But that's where theory and practice diverge. Could all the current systems of DF be implemented anew in a way that easily scales to however many CPU cores are available? Most likely in some way yes they could be. Could the current systems as implemented be ported to better scale with the number of available CPU cores? Questionable. Game engines are incredibly complex -- there are usually dozens if not hundreds of systems interacting with each other. Over time, this all ossifies to the point where making changes to one system requires changes to many other systems. This is kind of a fact of life with almost every game engine or codebase that I have encountered, worked with, or heard of. When you start getting into more than a decade of development, there are going to be a lot of tangled systems that are going to be very difficult to pull apart. Yes, the fundamental problem may be solved for multiple threads, but DF solved it for one thread, and that solution is part of what makes DF fun. Messing with that solution is asking for trouble.
- Macuyiko 6y agoForgive my ignorance, but do you have any good references to multi-threaded cellular automata implementations? This is something I've been dabbling with myself.