Try to use these instead of `SetWindowPos` to see if the perfomance is any better https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-begindeferwindowpos https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-deferwindowpos https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-enddeferwindowpos