User:Handlingcfg/Affinity Settings
When game performance (fps) is limited by cpu, setting specific affinity and priority could change the performance of the game. changing priority may cause stability issues for some games.
Basics
On multicore systems different variables effects the performance, therefore running game code on different configrations differentiates the fps. Generally, there are three main variable affects perfromance:
-The number of threads that game engine uses
-SMT (or HT) being on or off
-cpu affinity of game (affinity on real cores-faster cores)
Games developed to work on specific number of threads. This number depends to publishers market expectation and statistical distribution of core count of potential users for that time period.
-if game designed to work on 4 cores, and user has less than 4, the performance will be slower
-if game designed to work on 4 cores and user has more than 4, the performance could be slower or not.
-if ht/smt feature is on and user have 4 or more cores, the performance could be slower.
Setting Affinity with custom shortcut
method 1:
1)create new txt file in executables directory
2)add the line below with changing names
%WINDIR%\System32\cmd.exe /C start "exe name(here can be empty)" /AFFINITY NN "path to exe"
for NN:use [affinity calculator]
3)rename the file to ".bat"
4)create shortcut to bat file and change its icon
method 2 (with powershell):
if method 1 wont work for some situations:
1)create new txt file in executables directory
2)add the line below with changing names
%WINDIR%\System32\cmd.exe /C start "exe name(here can be empty)" /AFFINITY XX "path to exe"
than add the line below to second line
PowerShell "$Process = Get-Process -Name """gamenamewithouthspace*""" ; $Process.ProcessorAffinity=YY"
the * character is wildcard, it is used for remaining letters. for example for far cry 5, far* can be used, if only process is starting with far letters, it will work.
YY:is same number with NN,only starts with 0x, its like 0xNN
3)rename the file to ".bat"
4)create shortcut to bat file and change its icon
Set Priority with custom shortcut
add the line below to the bat file
wmic process where name="game.exe" CALL setpriority "128"
Turning off ht/smt
It is either turned of in bios, or with softwares that changing bios-efi settings (like amd ryzen master). For this you need to search how to change your motherboard brands bios.
General Affinity Mask numbers for ht/smt open
1--------1 core
5--------2 core
15-------3 core
55-------4 core
155------5 core
555------6 core
1555-----7 core
5555-----8 core
note:if ht/smt closed or your cpu doesnte have this feature, just use sequential numbers.