The game uses CPU resources inefficiently

This forum is the ideal place for all discussion relating to X4. You will also find additional information from developers here.

Moderator: Moderators for English X Forum

Shark22
Posts: 41
Joined: Wed, 17. Jul 24, 10:26

The game uses CPU resources inefficiently

Post by Shark22 »

V 7.1 beta 6 not modified

Since it is so important to you, I will write about it here. The game uses only 2 processor cores out of 32 and does it poorly. As you wrote in another topic, there can be many reasons for uneven core loading and they are all related to the game, because in all other games not made on Vulkan, oh miracle, all 32 cores are used equally. I built a very large station and now it is impossible to be within a radius of 100 km from it, because the FPS drops below 20. It does not matter whether I look at it or not, the FPS is several times lower than in other sectors where this station is not. You said very confidently that the problem was in the hardware. Apparently, this is normal that the rtx4090 and i9 13900k cannot provide high FPS near my station, in a 6-year-old game. It is not that difficult to make sure that the problem is in the game. Launch my save on your "amazing, perfectly assembled PC" and fly near my station in the Abyss.
dxdiag https://drive.google.com/file/d/1z8DoSM ... sp=sharing
vulkaninfo https://drive.google.com/file/d/18DHlKe ... sp=sharing
Save https://drive.google.com/file/d/1DiV4UH ... sp=sharing

Waiting for proof where you fly near my station in 4k ultra with 60+ FPS
Shark22
Posts: 41
Joined: Wed, 17. Jul 24, 10:26

Re: The game uses CPU resources inefficiently

Post by Shark22 »

Screen https://drive.google.com/file/d/1jiqT5h ... sp=sharing
I don't know why you can't make attachments in this thread
Imperial Good
Moderator (English)
Moderator (English)
Posts: 4933
Joined: Fri, 21. Dec 18, 18:23
x4

Re: The game uses CPU resources inefficiently

Post by Imperial Good »

The game uses only 2 processor cores out of 32
The Intel i9-13900K only has 24 cores. Of those, only 8 are really suitable for X4, as it is single thread bound so the E cores do not bring much value.

So X4 is using at least 25% of your performance CPU resources, since the performance cores have hyperthreading which can largely be ignored.
Shark22 wrote: Sat, 10. Aug 24, 21:51 because in all other games not made on Vulkan, oh miracle, all 32 cores are used equally.
Vulkan is designed with multithreading in mind. Check out the API documentation if you do not believe word of mouth. Both D3D12 and Vulkan are similar in this regard.

Such games are not using 32 cores, your processor only has 24 as per the above explanation...

Most games will not use 24 cores. Some rare modern AAA games will, but I can tell you with certainty that games like Warcraft III, StarCraft II, Anno 1800 and Factorio will CPU bottleneck well before the CPU reaches 100% utilisation due to single thread performance limits.
Shark22 wrote: Sat, 10. Aug 24, 21:51 I built a very large station and now it is impossible to be within a radius of 100 km from it, because the FPS drops below 20.
20 is still quite playable. I have situations where FPS drop below 5 due to excessively large or numerous stations.

The solution to this is to limit the module density, and as such size, of stations. A lot of people would hate this...
Shark22 wrote: Sat, 10. Aug 24, 21:51 You said very confidently that the problem was in the hardware. Apparently, this is normal that the rtx4090 and i9 13900k cannot provide high FPS near my station, in a 6-year-old game.
Your processor is 2 years old so is only 4 years newer than the game. It also is not optimised for gaming, most games do not benefit from the 16 E cores which is why it often loses out to the 8 core AMD Ryzen 7 7800X3D in a large range of games. It performs very similar to most i5 and i7 processors of the same generation from Intel. The 16E cores only really shine in multi-tasking situations, which are often productivity cases (not gaming).
Shark22 wrote: Sat, 10. Aug 24, 21:51 Waiting for proof where you fly near my station in 4k ultra with 60+ FPS
X4 does not target this when interaction with big stations is involved. It is a sandbox game and as such it cannot guarantee you performance in all situations. If you build your stations like the NPC stations then it is quite likely to achieve 60+ FPS with 4K on a high end system, but most players would dislike such small limits.
Shark22
Posts: 41
Joined: Wed, 17. Jul 24, 10:26

Re: The game uses CPU resources inefficiently

Post by Shark22 »

It's very strange to compare X4 with such old games as Warcraft 3 and Starcraft 2. And even more so to compare it with games with a top-down view. The only thing they have in common is the ability to build. If X4 had been a top-down view, there would be no questions about performance, because there would be no problems with it. In the same Factorio, the processor resources are needed so little that even a couple of tabs in Google load the CPU more. Unlike the games you mentioned, X4 is a game with excellent graphics, very beautiful views and a first-person view. And watching this at 15-20 FPS, while the usual FPS is 80-120, is, to put it mildly, unpleasant.
Why don't you then improve the game so that it uses both threads of these 8 cores or starts to fully use the E-cores? Or better yet, both options at once, like in Cyberpunk 2077.
I wouldn't say that X4 is just a sandbox. It's a shooter, a simulator, and an adventure.
db48x
Posts: 107
Joined: Mon, 15. Jul 13, 06:25
x4

Re: The game uses CPU resources inefficiently

Post by db48x »

Shark22 wrote: Sun, 11. Aug 24, 00:47 Why don't you then improve the game so that it uses both threads of these 8 cores or starts to fully use the E-cores?
If only it were that easy.

Hyperthreading is a great benefit a lot of the time, but it is important to remember that it has very important limitations. Each core can do a certain specific amount of work each clock cycle, and hyperthreading doesn’t change that. It is hard to explain briefly, but imagine a program that has to fetch a bunch of numbers from memory and then multiply them all together. Fetching from memory takes time, and multiplying numbers takes time. Each core has a number of functional units that are dedicated to one specific task, sometimes called ports. If the port that fetches from memory is busy, the port that is needed for multiplying might be idle¹. If the core can only execute a single thread, then when this program is running only part of the CPU is busy on any given clock cycle. But now if you run two threads from the same program, they can be interleaved. One can be fetching from memory while the other is multiplying and visa versa. This is because they both use a mixture of ports, and can swap ports back and forth nicely.

But now imagine a program where every instruction needs the same port, over and over again. Now if you run two threads of this program, only one of them can make any progress at a time. Hyperthreading isn't very useful here, because both threads want to use the same port. The second thread just has to wait. Hyperthreading isn’t magic; it doesn’t make your cpu able to do more work at the same time in all cases. You need a second core in order to guarantee that.

Of course, your CPU does have extra cores. In fact it has 8 great cores. It’d be pretty nice if the game could use more of them. The sad reality is that it is pretty hard for programmers to reliably use multiple cores all the time. Not everything that the program does can be usefully split up between cores, and even when it is possible to do it may not be feasible to do. Remember that EgoSoft has to balance the cost of development against the revenue from sales. Sadly performance is rarely the number one priority for game developers. Once they hit a certain target performance, they usually have to move on to other work. They fixed a whole lot of bugs for the 7.10 release, and that kind of thing takes time away from performance improvements. It’d be a shame if the game were super fast only to turn out to be super buggy as well. Maybe one day they will fix the very last bug, and then they’ll be able to spend a few months on performance.

¹ On your CPU, the best information that I have is that multiplying two numbers needs both ports 1 and 5, while simply fetching from memory needs ports 6 and 23A. The instruction that both fetches something from memory and then multiplies it with a register needs ports 1, 5, and 23A, but not port 6. No idea why. You can see that it is actually pretty complicated! See https://uops.info/table.html. You have a Raptor Lake CPU, but if you select Alder Lake (the predecessor), you’ll get the best available information. Search for an instruction like CMOV, which fetches from memory, and look at the port column. Click on it for details. Note that there is both Alder Lake-P and Alder Lake-E for the performance and efficiency cores, respectively.
Zanthra
Posts: 13
Joined: Sat, 10. Aug 24, 03:15

Re: The game uses CPU resources inefficiently

Post by Zanthra »

db48x wrote: Sun, 11. Aug 24, 03:39
Shark22 wrote: Sun, 11. Aug 24, 00:47 Why don't you then improve the game so that it uses both threads of these 8 cores or starts to fully use the E-cores?
If only it were that easy.

Hyperthreading is a great benefit a lot of the time, but it is important to remember that it has very important limitations. Each core can do a certain specific amount of work each clock cycle, and hyperthreading doesn’t change that. It is hard to explain briefly, but imagine a program that has to fetch a bunch of numbers from memory and then multiply them all together. Fetching from memory takes time, and multiplying numbers takes time. Each core has a number of functional units that are dedicated to one specific task, sometimes called ports. If the port that fetches from memory is busy, the port that is needed for multiplying might be idle¹. If the core can only execute a single thread, then when this program is running only part of the CPU is busy on any given clock cycle. But now if you run two threads from the same program, they can be interleaved. One can be fetching from memory while the other is multiplying and visa versa. This is because they both use a mixture of ports, and can swap ports back and forth nicely.

But now imagine a program where every instruction needs the same port, over and over again. Now if you run two threads of this program, only one of them can make any progress at a time. Hyperthreading isn't very useful here, because both threads want to use the same port. The second thread just has to wait. Hyperthreading isn’t magic; it doesn’t make your cpu able to do more work at the same time in all cases. You need a second core in order to guarantee that.

Of course, your CPU does have extra cores. In fact it has 8 great cores. It’d be pretty nice if the game could use more of them. The sad reality is that it is pretty hard for programmers to reliably use multiple cores all the time. Not everything that the program does can be usefully split up between cores, and even when it is possible to do it may not be feasible to do. Remember that EgoSoft has to balance the cost of development against the revenue from sales. Sadly performance is rarely the number one priority for game developers. Once they hit a certain target performance, they usually have to move on to other work. They fixed a whole lot of bugs for the 7.10 release, and that kind of thing takes time away from performance improvements. It’d be a shame if the game were super fast only to turn out to be super buggy as well. Maybe one day they will fix the very last bug, and then they’ll be able to spend a few months on performance.

¹ On your CPU, the best information that I have is that multiplying two numbers needs both ports 1 and 5, while simply fetching from memory needs ports 6 and 23A. The instruction that both fetches something from memory and then multiplies it with a register needs ports 1, 5, and 23A, but not port 6. No idea why. You can see that it is actually pretty complicated! See https://uops.info/table.html. You have a Raptor Lake CPU, but if you select Alder Lake (the predecessor), you’ll get the best available information. Search for an instruction like CMOV, which fetches from memory, and look at the port column. Click on it for details. Note that there is both Alder Lake-P and Alder Lake-E for the performance and efficiency cores, respectively.
Assuming there is anything for the CPU to do at that time. If the GPU is maxed out rendering the thousands of station components on 4k Ultra graphics settings, then the CPU may be idle because it's waiting on the GPU to finish.
Shark22
Posts: 41
Joined: Wed, 17. Jul 24, 10:26

Re: The game uses CPU resources inefficiently

Post by Shark22 »

Considering the cost of the game and all its DLC, I don't think the company has any problems with the budget. Otherwise, even 7.1 would not have come out. I hope the developers will finally start optimizing the core load. After all, they made the maximum station size 20x20x20. I would like to calmly fly around it, and not admire it in the construction mode, in which the FPS barely reaches 40.
When there are no stations nearby, the processor manages to load the video card by 90-100% and you can already play with a pleasant 100-120 FPS. But as soon as stations appear in sight, real problems begin. Several small stations are not such a problem, but when there are many of them, for example, as in the Argon Prime sector, the processor stops keeping up with the GPU, since it is used at barely 15-20% and provides less than half of the video card load. This is very frustrating, considering that one of the main advantages is the beauty and scale of this game.
Alan Phipps
Moderator (English)
Moderator (English)
Posts: 31789
Joined: Fri, 16. Apr 04, 19:21
x4

Re: The game uses CPU resources inefficiently

Post by Alan Phipps »

No longer a Tech Sp report but now a techie discussion/debate. Back to the general forum.
A dog has a master; a cat has domestic staff.
User avatar
Old Drullo321
Posts: 1070
Joined: Sat, 7. Feb 04, 16:01
x4

Re: The game uses CPU resources inefficiently

Post by Old Drullo321 »

It seems to me that the intention of the OP is just to rant over game performance disregarding any kind of technical explanation given by other users / moderators or even google / general information available. Even if you take computer science courses specifically on the field of sharing workload / multithreading, they will tell you the same.

This topic comes up repeatedly and frequently and by no means I want to be rude, but the answers can be summarized like this:

- Sharing workload / Multithreading / Concurrent computing is a complicated matter, certain workload can be split more, less or not at all. And split up workload isn't even guaranted to net performance gains because doing things concurrently in the first place comes with a costs of it own. So only because a game (like X4 or others) doesn't use more then [insert CPU cores here] doesn't mean it isn't multithreaded. Just splitting workload for the sake of multi-threading mayb be harmful if you don't know what you are doing and some workload can't be done parallel at all. Period.

- Throwing a reasonable amount of money, time, working hours at the problem only will gain you so much. Not specifically related to multi-threading but X4 received alot of noticeable amount of performance gain in various sectors (like loading times, map overlay performance, etc). So you see the devs are doing what they can. Maybe throwing billion dollars and the whole NASA developers at the engine will actual increase performance even further (while simultaneously beeing financially unstable for a small company like Egosoft) but even then i guarantee you, they won't magically increase performance by 50%.

- X4, like some others games already mentioned in this thread is a mainly CPU-intense game (in contrast to many more "mainstream" AAA titles, often egoshooters and the like). Certain CPU architectures may work better or worse in these cases. You may don't want to hear it but your 24-CPU "HighEnd" Intel 13900k will likely perform worse in these games then a AMD 7800X3D only-8-core processor. You could say, you used your money inefficiently by buying a CPU with a similar (or worse) price for a scenario where other available CPUs would have performed better (reacting to the thread title that the CPu uses ressources inefficiently).

- Certain performance problems (and some other game related issues) can be improved or delayed by trying to circumvent the issue. For example, large stations can be split into multiple stations, even divived between multiple sectors

- And last but not least, modern hardware may throttle when it gets to hot which will lead to a performance decrease. This usually is at the responsibility of the user to take care of and has nothing to do with software, applications/games other then maybe written inefficently (example: intro screen not fps capped). But that only leads to higher workload. If the cooling isn't enough or can't work properly, then it lies in the responsibility of the user to take care of this. (I only mention this because in one of your other threads you mention CPU overheating. This isn't meant as an offense.)

And yes, I also get very low one-digit framerates in certain situation I can barely avoid and sometimes it annoys me to no end because sometimes different gameplay design decisions don't work very well togther (for example: the game encourages you to use the PHQ personal office but on the other time the gameplay element "terraforming" encourages, even enforces you to build alot of stuff on your PHQ, making the use of the personal office detrimental to your game experience).
Panos
Posts: 880
Joined: Sat, 25. Oct 08, 00:48
x4

Re: The game uses CPU resources inefficiently

Post by Panos »

Shark22 wrote: Sat, 10. Aug 24, 21:51 V 7.1 beta 6 not modified

Since it is so important to you, I will write about it here. The game uses only 2 processor cores out of 32 and does it poorly. As you wrote in another topic, there can be many reasons for uneven core loading and they are all related to the game, because in all other games not made on Vulkan, oh miracle, all 32 cores are used equally. I built a very large station and now it is impossible to be within a radius of 100 km from it, because the FPS drops below 20. It does not matter whether I look at it or not, the FPS is several times lower than in other sectors where this station is not. You said very confidently that the problem was in the hardware. Apparently, this is normal that the rtx4090 and i9 13900k cannot provide high FPS near my station, in a 6-year-old game. It is not that difficult to make sure that the problem is in the game. Launch my save on your "amazing, perfectly assembled PC" and fly near my station in the Abyss.
a) Your 32 cores are not equal. You have an 8 core CPU with some additional low power cores and how all this work together depends how the crappy Windows scheduler handles them.
I would advice to install Project Lasso to enhance/bypass the scheduler. Open the game, and set it in Project Laso to have permanent High Priority (no more) and set it to run on the 8 P-cores (not the hyper threads). Do not select any of the E-cores. There is also a setting to disable HT when playing this game. Try it.

b) What is your ram speed? Have you activated XMP profile? Because the game is a big number cruncher.

c) Consider trying the game on Linux. I have switched since 2019 and the game runs faster, expanding on all 12 (3900X) and 16 (5950X currently) cores, providing much better perf than on Windows. On your case the Linux Governors (scheduler) will still use the 8 P cores, will never put the game in the E cores but have the tendency to do better job than the Windows Scheduler.

d) X4 is the only game having a 100% realistic background simulator. Been "6y old game" means nothing when there isn't any other game except like EVE Online, having similar background simulator, and EVE requires server farm to run. So for what it is, is very well optimised.

e) Don't build mega stations. Is more efficient and faster to build multiple 1-2 product stations and use freighters to move goods. Shame Egosoft removed the automated drone operations (to improve perf) so when a station is near each other they didn't require dedicated freighters. The cargo drones did the job automatically removing the hassle.
R-TEAM
Posts: 139
Joined: Sun, 25. Dec 11, 19:50
x4

Re: The game uses CPU resources inefficiently

Post by R-TEAM »

yea - the OP even dont understand his HW correct - let alone modern cpu architecture and utilization ....
Dont think an discuss will change this - and he think because of the marketing words he have picked up, now he is the HW and coding pro ..........................
flywlyx
Posts: 1581
Joined: Sat, 15. May 21, 03:45
x4

Re: The game uses CPU resources inefficiently

Post by flywlyx »

Panos wrote: Mon, 12. Aug 24, 06:18 d) X4 is the only game having a 100% realistic background simulator. Been "6y old game" means nothing when there isn't any other game except like EVE Online, having similar background simulator, and EVE requires server farm to run. So for what it is, is very well optimised.
Many games use background production calculations, with Anno and Mount & Blade being two similar examples. Although Anno features fewer islands/areas, it has more factories per island.
Both games perform better than X4 because their trading is between islands or cities, whereas X4 involves trading between individual factories, making each search significantly more complex.
Panos
Posts: 880
Joined: Sat, 25. Oct 08, 00:48
x4

Re: The game uses CPU resources inefficiently

Post by Panos »

flywlyx wrote: Mon, 12. Aug 24, 21:24
Panos wrote: Mon, 12. Aug 24, 06:18 d) X4 is the only game having a 100% realistic background simulator. Been "6y old game" means nothing when there isn't any other game except like EVE Online, having similar background simulator, and EVE requires server farm to run. So for what it is, is very well optimised.
Many games use background production calculations, with Anno and Mount & Blade being two similar examples. Although Anno features fewer islands/areas, it has more factories per island.
Both games perform better than X4 because their trading is between islands or cities, whereas X4 involves trading between individual factories, making each search significantly more complex.
Come on. Both those games are totally DUMB compared to X4.

Neither of them has spaceships physically fly, picking orders based on that's available to maximize profits, managing military fleets to wage war, expand into sectors, order at shipyards what they need, organize incursions and so on.
jlehtone
Posts: 22546
Joined: Sat, 23. Apr 05, 21:42
x4

Re: The game uses CPU resources inefficiently

Post by jlehtone »

Shark22 wrote: Sat, 10. Aug 24, 21:51 The game uses only 2 processor cores out of 32 and does it poorly. As you wrote in another topic, there can be many reasons for uneven core loading and they are all related to the game, because in all other games not made on Vulkan, oh miracle, all 32 cores are used equally.
What does "use equally" mean?

Lets say there are four cores. Game A has one thread that uses one core 100%, continuously. Does the "use equally" mean that game B, also one thread, hops between cores. At any moment exactly one core is at 100%, but over time all are at 25%? If so, then which of the games is "better"?
Shark22 wrote: Sat, 10. Aug 24, 21:51 Waiting for proof where you fly near my station in 4k ultra with 60+ FPS
Unfortunately you have to provide 4k screens for all users before anyone can even try.

(Don't send one to me though, I will not enable the "show FPS" feature.)
Goner Pancake Protector X
Insanity included at no extra charge.
There is no Box. I am the sand.
Imperial Good
Moderator (English)
Moderator (English)
Posts: 4933
Joined: Fri, 21. Dec 18, 18:23
x4

Re: The game uses CPU resources inefficiently

Post by Imperial Good »

Shark22 wrote: Sun, 11. Aug 24, 00:47 In the same Factorio, the processor resources are needed so little that even a couple of tabs in Google load the CPU more.
Factorio is used to benchmark modern CPUs. It can be extremely demanding on the CPU due to its highly level of optimisation and high data throughput and is written with multithreading in mind so will even benefit a little from larger core count CPUs. You are possibly confusing its graphic work load where it barely taxes modern discrete GPUs.
Shark22 wrote: Sun, 11. Aug 24, 00:47 hy don't you then improve the game so that it uses both threads of these 8 cores
Because that typically results in a total computation improvement of between 0% and 4%. Most of the time the virtual core will steal half the cycles from the other virtual core on the same physical core, typically resulting in each virtual core running at half speed of only 1 loaded virtual core per CPU. This is likely one of the reasons Intel is rumoured to remove HT technology from future processing generations, and why Apple does not use an equivalent technology at all in its M series of processors. 1 P core and 1 E core is a lot faster (by about ~50%) than just 1 P core with HT.

The added performance from HT can easily be lost by thread synchronisation overhead or by causing 1 thread to block longer due to it running at half speed.
Shark22 wrote: Sun, 11. Aug 24, 00:47 or starts to fully use the E-cores
Very hard to design games to do this, especially since the same game must run well on processors with a fraction of the core count. Most developers target 6-8 cores at the moment. The E cores still do have value for running background tasks, which is what Intel drivers often force them to do and deny them from running games to prevent performance regressions.

Using the E cores can reduce the performance of the P cores due to the higher power usage resulting in lower P core clock speed.
Shark22 wrote: Sun, 11. Aug 24, 00:47 like in Cyberpunk 2077.
And Cyberpunk lets you construct your own skyscrapers? Or place thousands of roads on top of each other? Cyberpunk is a completely different sort of sandbox game so has been designed in a way to avoid situations which the player can make in X4 such as building a station with thousands of modules.

Does cyberpunk use E cores?
db48x wrote: Sun, 11. Aug 24, 03:39 If the core can only execute a single thread, then when this program is running only part of the CPU is busy on any given clock cycle. But now if you run two threads from the same program, they can be interleaved. One can be fetching from memory while the other is multiplying and visa versa. This is because they both use a mixture of ports, and can swap ports back and forth nicely.
Then you get to modern CPUs which can run between 4 and 6 instructions per cycle and are highly pipelined so most ports can be used by instructions every cycle. Most of the ports can be saturated with just a single thread, especially in tightly optimised loops. In your example you can have the same virtual core issue a memory read while dispatching a multiply instruction and an add instruction per cycle. This is why HT throughput benefits are often quite low and why there is a large argument in industry to get rid of HT completely, with modern OSes already deprioritising HT cores.

The benefits from HT are mostly when a thread blocks such as due to pipeline dependency caused stalls or for slower memory I/O. In this case another thread can be run until the block is resolved in a way that high-level scehduling cannot support resulting in some additional cycles of work.
db48x wrote: Sun, 11. Aug 24, 03:39 The instruction that both fetches something from memory and then multiplies it with a register needs ports 1, 5, and 23A, but not port 6.
These instructions are deprecated. For better performance the programmer should use separate instructions to read from memory into registers and then perform the multiply on values in registers (RISC style). Both cases should result in similar performance in a tight loop but the legacy CISC style instructions usually have additional microop generation overhead when encountered outside the microop cache and can prevent some execution optimisations.
Shark22 wrote: Sun, 11. Aug 24, 10:40 After all, they made the maximum station size 20x20x20.
This is because some of the logic used, specifically path finding if I recall, can only support objects of that size. Bigger and things would start to break.
Old Drullo321 wrote: Sun, 11. Aug 24, 17:55 You may don't want to hear it but your 24-CPU "HighEnd" Intel 13900k will likely perform worse in these games then a AMD 7800X3D only-8-core processor.
Very hard to say. In simple scenes the 13900k will still beat it as far as I am aware. Even in complex scenes some user feedback points to the 13900k winning. I suspect this is largely because of the lower memory latency and all the extra cache does not help as much when the data set is larger than the cache size.
db48x
Posts: 107
Joined: Mon, 15. Jul 13, 06:25
x4

Re: The game uses CPU resources inefficiently

Post by db48x »

Imperial Good wrote: Mon, 12. Aug 24, 23:05
db48x wrote: Sun, 11. Aug 24, 03:39 If the core can only execute a single thread, then when this program is running only part of the CPU is busy on any given clock cycle. But now if you run two threads from the same program, they can be interleaved. One can be fetching from memory while the other is multiplying and visa versa. This is because they both use a mixture of ports, and can swap ports back and forth nicely.
Then you get to modern CPUs which can run between 4 and 6 instructions per cycle and are highly pipelined so most ports can be used by instructions every cycle. Most of the ports can be saturated with just a single thread, especially in tightly optimised loops. In your example you can have the same virtual core issue a memory read while dispatching a multiply instruction and an add instruction per cycle. This is why HT throughput benefits are often quite low and why there is a large argument in industry to get rid of HT completely, with modern OSes already deprioritising HT cores.
This is quite true. I thought about mentioning pipelining and out of order execution, but decided that the complexity of my description was already high enough, plus they weren’t directly relevant to hyperthreading. And then on top of all of that there’s speculative execution and branch prediction. Modern CPUs are incredibly complex.
Imperial Good wrote: Mon, 12. Aug 24, 23:05
db48x wrote: Sun, 11. Aug 24, 03:39 The instruction that both fetches something from memory and then multiplies it with a register needs ports 1, 5, and 23A, but not port 6.
These instructions are deprecated. For better performance the programmer should use separate instructions to read from memory into registers and then perform the multiply on values in registers (RISC style). Both cases should result in similar performance in a tight loop but the legacy CISC style instructions usually have additional microop generation overhead when encountered outside the microop cache and can prevent some execution optimisations.
I would just like to know why it doesn’t need to use port 6! Maybe Intel does this kind of thing just to drive people mad.
flywlyx
Posts: 1581
Joined: Sat, 15. May 21, 03:45
x4

Re: The game uses CPU resources inefficiently

Post by flywlyx »

Panos wrote: Mon, 12. Aug 24, 22:34 Come on. Both those games are totally DUMB compared to X4.

Neither of them has spaceships physically fly, picking orders based on that's available to maximize profits, managing military fleets to wage war, expand into sectors, order at shipyards what they need, organize incursions and so on.
From what I can tell, the AI in both games handles the tasks you mentioned much better than X4. While relatively basic compared to other 4X games, they have a functioning diplomatic system, and wars have clear objectives rather than ships just fighting aimlessly.
Shark22
Posts: 41
Joined: Wed, 17. Jul 24, 10:26

Re: The game uses CPU resources inefficiently

Post by Shark22 »

Factorio is used to benchmark modern CPUs. It can be extremely demanding on the CPU due to its highly level of optimisation and high data throughput and is written with multithreading in mind so will even benefit a little from larger core count CPUs. You are possibly confusing its graphic work load where it barely taxes modern discrete GPUs.
No, I didn't get it wrong. I have a large number of modules built with tens of thousands of conveyors, manipulators and various production modules, but the processor is loaded by barely a couple of percent.

Because that typically results in a total computation improvement of between 0% and 4%. Most of the time the virtual core will steal half the cycles from the other virtual core on the same physical core, typically resulting in each virtual core running at half speed of only 1 loaded virtual core per CPU. This is likely one of the reasons Intel is rumoured to remove HT technology from future processing generations, and why Apple does not use an equivalent technology at all in its M series of processors. 1 P core and 1 E core is a lot faster (by about ~50%) than just 1 P core with HT.
I am not a programmer and do not know how all this is done, but perhaps your developers will still be able to find some way to improve the calculations in the game, because FPS drops not only near huge stations, but also with a large number of stations built by bots. In such cases, it can decrease by 2-3 times. It is good that during combat clashes with a large number of ships there is no such problem. Although perhaps my fleet is not large enough.

And Cyberpunk lets you construct your own skyscrapers? Or place thousands of roads on top of each other? Cyberpunk is a completely different sort of sandbox game so has been designed in a way to avoid situations which the player can make in X4 such as building a station with thousands of modules. Does cyberpunk use E cores?[
Although you can't build in it, there are still a lot of elements that need to be drawn. But it doesn't have the same calculations as X4. Maybe the problem is not only in the large number of modules, but also in the production line. If I am 80+ km away from the station and look at it, the FPS stays at 70-80. Even if I zoom in, the FPS stays above 30. But if I teleport to the station, it doesn't matter at all whether the station modules are visible or not. Even if I enter a room where these modules are not visible, the FPS does not rise above 15. Maybe the production line calculations require more resources when approaching the station? Or the PC just tries to draw the station modules because I am on it, although I cannot see them. And yes, Cyberpunk uses all E-cores.
af_2017
Posts: 724
Joined: Sun, 7. Oct 18, 19:55
x4

Re: The game uses CPU resources inefficiently

Post by af_2017 »

Panos wrote: Mon, 12. Aug 24, 06:18 c) Consider trying the game on Linux. I have switched since 2019 and the game runs faster, expanding on all 12 (3900X) and 16 (5950X currently) cores, providing much better perf than on Windows.
Could you please prove it? Screenshot of the system monitor should be enough. Because you know changing OS to see the same would be frustrating. Thank you!
X4 is not a destination. It's a journey. Unfortunately in a wrong direction.
jlehtone
Posts: 22546
Joined: Sat, 23. Apr 05, 21:42
x4

Re: The game uses CPU resources inefficiently

Post by jlehtone »

Shark22 wrote: Tue, 13. Aug 24, 14:35 I am not a programmer and do not know how all this is done
This is true for most of us. Furthermore, I bet even most of programmers do not know how to write parallel code.


Have you seen either of the "The Flight of the Phoenix" films? In the plot there is a plane and for certain reason the characters have to do "little tweaks" in order to fly home with it. My guess is that X4 would need more work than that plane before it starts "firing on all cylinders".
Goner Pancake Protector X
Insanity included at no extra charge.
There is no Box. I am the sand.

Return to “X4: Foundations”