Thread are slower in cooked game

When executing a simple C++ loop in a FRunnable in the game like so, the performance are widely different from the uncooked game (Whether it’s in editor, or in right click>launch game standalone) and cooked (whether the game is packaged or not). I have observed around 50% difference, which is massive, it seems for some reason the thread is code is executing slower when the cooked game runs…

link to code : class ThreadChunk : public FRunnable {public: bool bAlive = true; - Pastebin.com

Preview :

This is kind of hard to take it as a valid test in UE4 you suppose to use UE4 API. Can you try to do the same with FDateTime, TArray, FMath and potentially with UE4 stat system:

You can also use Unreal Insights:

Anyway UE4 is out of control of your thread when your code loop, it does not got thru any control code aspecially as you use C++ standard API UE4 is complitly unaware what are you doing in that thread. OS is one deciding when and how it is executed on CPU or else UE4 telling OS to do something with it, so it’s either that that or compilationconfiguration diffrence makes something

Also make sure to do run on both Development build and Shipping build as both are complitly diffrent builds on UE4

Hello,
Closing the thread as I have figured it out.
Essentially, my threads were using std:: stuff, and for some reason, thoses stuff were a lot slower on threaded versions. In editor, somehow, it seems the UE does definitly change the way threads works, since they act closer to what single threads would look like (just look at how low your CPU usage is, regardless of thread count) so the multithread issue with std wouldnt be such a problem. I believe this might be because of the single process simulated when you play in editor.

Moving to Txxxx did fix my issues, since those work well regardless of thread count.

Thanks for your help