MassEntity threading model in 5.8

Hello,
I upgraded my plugin (https://www.fab.com/portal/listings/bfcc52a6-6ee7-4d78-a7be-c65ce4f0a18c/edit) for UE 5.8 with the release earlier this week. However, there is a significant change in the threading model that causes the performance of my plugin to be cut by half. Essentially it boils down to Mass Processors queries ParallelForEach now being executed inline instead of through a task per chunk. The EParallelExecutionFlags on the methods is ignored and instead a global UE::Mass::Tweakables::bForceInlineProcessorExecution takes over and cancels out the multithreading that we had since 5.4.
The value of UE::Mass::Tweakables::bForceInlineProcessorExecution is private, and a readonly cvar so it seems it cannot be changed. However, when, at runtime, I manually go change the value in memory for that variable, I get back to the old threading model and my performance comes back to what is expected and even better than in 5.7 (I had 55FPS on a test scene with 10K entities, this drops to 22FPS with 5.8, but goes back up to 75FPS if I disable processor inlining).

So I think there was an omission here or perhaps some API change I do not understand. Essentially, all the ParallelForEach methods have become useless as they do not respect the expected parallelism, regardless of the EParallelExecutionFlags provided. I have not seen anything in the project settings to get the old behaviour back, nor can I see a way to configure a processor to multithread the chunks processing with ParallelForEach calls.

Am I missing something? This really looks like a breaking change.

1 Like