From 4df563f1bb45ae3418862e8a365865fdd8bd090c Mon Sep 17 00:00:00 2001 From: Kang Yu Date: Sat, 3 May 2025 16:33:47 -0700 Subject: [PATCH] speedup PW startup restore by setting set process priority to high during the first 10 seconds of PW starting --- .../SystrayShell/Program.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Ninjacrab.PersistentWindows.Solution/SystrayShell/Program.cs b/Ninjacrab.PersistentWindows.Solution/SystrayShell/Program.cs index 37705b2..909c6d8 100644 --- a/Ninjacrab.PersistentWindows.Solution/SystrayShell/Program.cs +++ b/Ninjacrab.PersistentWindows.Solution/SystrayShell/Program.cs @@ -48,6 +48,15 @@ if not errorlevel 1 goto wait_to_finish"; [STAThread] static void Main(string[] args) { + var process = Process.GetCurrentProcess(); + var process_priority = process.PriorityClass; + process.PriorityClass = ProcessPriorityClass.High; + var timer = new System.Threading.Timer(state => + { + process.PriorityClass = process_priority; + }); + timer.Change(10000, System.Threading.Timeout.Infinite); + Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false);