I am posting it again, hopefullly I will at least receive an explanation next time if my topic is removed.
---------------------------------------------------------------
TL;DR
Enable processing electric networks in a multi-threading fashionWhat ?
Change machines to have a set of "virtual internal accumulators", each for a single electric network, thus each machine no longer interacts with multiple electric networks, making the code multithread-able.Why ?
Electric networks could be made multi-threaded, potentially massively increasing performance.---------------------------------------------------------------
(Disclaimer: I am a software dev for 20+ years)
I think I may have a potential solution to fix the "one device connected to multiple electric networks" which apparently wrecks multithreading.
Basically, what I am thinking, instead of having 1 machine interact with multiple electric networks, each machine could have a set of multiple virtual internal accumulators, instead of just 1 accumulator like now. These accumulators do not actually exist, they are virtual constructs for the purpose of performance.
They could be reduced to few simple variables and functions, no virtual object has to actually exist.
The number of virtual accumulators would be equal to how many networks is the machine connected to. Each virtual accumulator would only draw power from related electric network. Such a scheme could be made multi-threaded, because essentially the machine is no longer connected to multiple electric networks. It's only connected to its internal accumulators.
Then the machine would draw power, either equally or using some simple logic, from these accumulators, this can be done on yet another thread.
Potential advantages:
- Whole scheme can be completely multi-threaded
- It will be possible to divide electric networks between multiple CPU threads, each network can run independently
- Possible performance improvements?
Potential disadvantages:
- There will be more total objects in game, so total performance impact is uncertain, would have to be benchmarked ultimately
- Moderately increased complexity of processing electric networks
- Slightly increased complexity of machines in general
- Slightly increased memory usage
I am not saying I am absolutely certain this fixes the problem yet, without benchmarks it's really hard to tell, but I think the concept is sound.
Related screenshot: