I notice that Escape from Tarkov has an option to “use only physical cores”.
When I tested this in my game by setting cpu affinity in task manager to 0,2,4,6,8 I noticed I get a 10% performance boost. It would be great to have this setting in my options menu too, but I can’t work out how to do it in unity.
I thought I could use Process.ProcessorAffinity but haven’t had any success making it work (in editor or in builds, even running as admin)
Measure this again using other cores eg 0,1,2,3,4 (did you really test 5 cores?).
I don’t think there is a guarantee that odd numbered cores are virtual (hyperthreading) cores in task manager.
The performance difference could also be attributable to other effects, specifically limiting the number of cores in general. It can be less efficient for a game to utilize 12 cores when it can hardly keep 4 cores busy. It can be more efficient to lock an application to the cores on a single chiplet, but sometimes it may be more efficient to lock the game to one core per chiplet depending on how the cache is accessed and distributed across cores and chiplets.
Personally I’d advice against proceeding with that information because you’ve only tested it on a single system. Mileages may vary, specifically if the CPU generation or vendor (AMD, Intel) is different. The performance characteristics vary across the board, and they may change significantly with just a single change in your game’s code.
You may also shoot yourself in the foot on systems that don’t have hyperthreading.
Thank you for the thoughtful reply. You were right, I didn’t test with just 5 cores, I enabled every other one on my 3950x.
Good point about people without hyperthreading. I was hoping to have it as an option in settings so maybe that would make it ok.
I was going to test more on different systems if I was able to get it working as a unity option. Having a quick search it seems to be a thing people do to get better frame rates with lower CPU utilisation. Still seems a shame to leave potentially 10% performance increase untapped. Although I have to admit I was running on low graphics settings to make sure the cpu was stressed more than it usually would be, I didn’t get round to testing on high quality, high resolution.