Context
I had the same problem on my laptop. I always heavily multitask, and I have a somewhat powerfull laptop. The latest benchmark that I did put this machine on in front of most cheap laptops that are sell at 300-400 euros, with far less RAM.
- Core i7 3940XM - Benchmark is OK (CPU-Z, etc).
- 16 Gb RAM DDR3 in dual channel
- SSD SATA Samsung 870 EVO - Benchmark is OK, 500 Mb/s.
In fact, the thing that was susprising me is that on a "cold boot" the computer would be somewhat snappy. But the more I multitask (usualy 6-7 programs open at the same time, because I have monitoring programs and automatisation programs) the more it would become insanely slow and jerky.
Symptoms
When you multitask, opening a window is very slow. Opening a new tab in Chrome is slow, swaping between windows is slow and jerky. If feels like the CPU is underclocked at 800 Mhz, on battery with all but one core turned off.
But, the funny part is that benchmarks are more than OK, and benchmarks don't show any sign of underclocked CPU, or GPU. Task Manager don't show no high CPU usage, or disk usage, memory consumption can be high but even after closing most of programs the PC will still be slow.
Assumptions
I feel like there is a bug in Windows (or a very bad programmation algorithm), as if the more GUI objects are displayed on the screen, the Windows algorithm is so bad/unoptimised that it lags with an insane high GUI object count.
I did some research, and the best way to know the load concerning the number of objects on the screen, is to go in Task Manager and to display a special column called "GDI Objects".
On one user account where I don't have this problem, there are 3200 GDI objects
in total.
On another user account where I have this problem, there are 8400 GDI objects
in total.
This isn't unfortunately linked in the Task Manager to either CPU either GPU load. The CPU can be totally idle, but the computer will lag.
Update This post was originaly written in ~2017. In 2023, I was still having the same issues, so I did some more reasearch. My conclusion is that, this is due to a mix of GDI objects leak and GDI object excess. Each user session in Windows gets a maximum number of GDI objects. The sessions are like virtualized, or if not they are limited. Whatever the real reason behind, when a user space reaches 10000 GDI objects (by default), it starts to throttle, a sort of "rate limit" of graphic objects, hence giving slowness and graphic glitches altought the CPU/GPU/Ram loads are fine. 3D games (i. e. speficically, so not 2D games) are special, so 3D games will run at full speed even if reaching this limit. This will mostly affect desktop performance. There are some regedit key to increase this value : GDIProcessHandleQuota
is an example. But note that those keys sometimes changes at every major OS version. As of Windows 10 (confirmed) and probably Windows 11, those keys are valid.
Solution
- Change registry keys. This is the first solution and the working one for people having the same issue. The problem could simply be that the maximum number of GDI objects per session is limited. When the user is at the limit, Windows would simply slow down the rendering of desktop objects, a sort of rate limit, in other words while CPU/GPU/Ram loads (and benchmarks) are fine. There are some keys to increase the limits (further testing required, I didn't test them for the moment), for example
GDIProcessHandleQuota
. This hypothesis explains why creating a new user session, or rebooting, or monitoring the number of GDI objects works. Removing CFG (and siblings) works also because it could reduce in some way the system load in heavy usage, making the system feel still snapy even with the "rate limit". The keys are :
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Windows
USERProcessHandleQuota
GDIProcessHandleQuota
USERNestedWindowLimit
Same keys in :
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\Windows
Then change keys in :
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Memory Management SessionPoolSize SessionViewSize
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\SubSystems Windows, increase the middle value of
"SharedSection"
- Monitor with GDIView. By using Nirsoft GDIView, there is a way to monitor this behaviour but there are some behaviors that I don't understand with GDIView (what Task Manager shows is not strictly equal to what GDIView shows).
Here is a simple Windows command line example to calculate the total amount of GDI objects with GDIView :
GDIView.exe /scomma %temp%\data.txt
set a=0
for /f "tokens=17 delims=," %i in ('type %temp%\data.txt') do set /a a+=%i
echo %a%
Disable CFG. Obviously, I disabled CFG. This give me a small performance boost, but the problem persisted.
Create a new user account. This is by far what works very good. It seems that the Windows GUI display code part is seriously overwhelmed when there are a lot of objects to display, but this works per user session. If you create a new user session, and use one session for the heavy tasks (heavy automation, multiple Firefox/Edge/Vivaldi/Chrome tabs) and one for light tasks, the problem is totally solved.
PS : old OS like Windows XP doesn't seem to have this problem at the extent of Windows 10/11. This seems to be linked to the way Microsoft implemented GDI/DirectDraw in Windows 10/11. It could be also Windows XP have far less graphic intense desktop, thus the performance is better when doing intensive desktop tasks.