J'ai observed a curious behaviour where processing in Unity Editor (TestRunner) takes 2.5s while the editor is dans le foreground, but slows down to 15s when I immediately tab to another app, thus putting the editor vers le background.
What's more: si je put the editor invers le background but constantly move the souris over the editor window, the processing completes dans le same time as si le editor were dans le foreground all the time.
Je suppose this to be some Windows (11?) optimization to purposefully lent down apps dans le background. I could not find a way to désactiver this for a particular app or système-wide for me as an end-utilisateur. Does such an option exist for end-utilisateurs or a workaround?
Is there anything an app developer can do to prevent this behaviour?
Parce que J'ai observed that the same problème ne exist when running Unity editor on Ubuntu 22 in VMware - the tests toujours complete fast regardless of whether I put the editor dans le background withdans le VM, and not even when I put the entire VM vers le background. This makes me hopeful that il y a ways to prevent this behaviour.
FYI: The whole problème a été documented as a bug report to Jetbrains and dans le Unity forum. I'm hoping Je n'ai pas to wait for a fix of either app, I'd rather wish to adjust some système setting and fix this highly undesirable Windows behaviour for good.
J'ai déjà tried changing the following paramètres to no avail:
Unity Editor interaction Mode (Preferences => General) set to "No Throttling" and "8 ms" (120 Hz)
using Gestionnaire des tâches to définissez le Unity.exe processus to "Realtime"
désactivé "Hardware-Accelerated GPU Scheduling" (Paramètres: Système>Display>Graphics>Par défaut graphics paramètres)
via Advanced Système Paramètres: Performance Options => Advanced I set "Adjust for best performances of: Background services"
turned off "Game Mode"
set plan d'alimentation to "Best Performance"
wrote an autohotkey script that moves the souris by 1px once every ms but this seulement speeds up execution by 50% (8s) and requires the cursor to be over the editor window
changed SystemResponsiveness to 64 (100%) (see below) and added NoLazyMode=1 (dans le same registry clé)
désactivé Windows Defender realtime protection (see comment)
désactivé powerthrottling of unity.exe via powercfg
manuellement adjusted Win32PrioritySeparation in registry
The last two tips were from this superuser post.
Temporary Workaround:
Ceci est an odd one but fonctionne reliably for me in Unity 2021.2 and newer. Cependant it needs to be re-applied manuellement après every script compile / assembly reload.
Open Preferences: General => Busy Progress Delay
Click and drag the label to changez le valeur (any valeur is fine as long as it is changed - IMPORTANT: it ne work by entering a valeur directly dans le text field!)
Run Unit Tests and put editor in background. Test continues to run fast.
J'ai essayé changing the corresponding EditorPrefs clé "EditorBusyProgressDialogDelay" avant running tests but this apparemment ne trigger the code that makes the tests en fait run faster. If anyone has any idea comment disassembly the editor code for the General Preferences that may help parce que ensuite I could en fait call that (possibly internal) method.
Additional note: setting Interaction Mode to No Throttling generally makes tests run 30% faster sur mon système!