Mazzarolo MatteoMazzarolo Matteo

Moving the mouse cursor can cause CPU spikes on macOS

By Mazzarolo Matteo


I recently noticed that just moving the cursor on my MacBook Pro causes CPU spikes.
The culprit is the WindowServer process: a core part of macOS responsible for drawing on the screen.

This seems to be a commonly reported bug (?) that started happening in Big Sur, where the WindowServer CPU usage scales with the polling rate of the input device:

Sigh.

I did some tests out of curiosity, and I can confirm that the CPU spike does scale with the polling rate.

The mouse I'm using daily (the one used in the recording above) is a Logitech Pro X Superlight, a gaming mouse with a 1000 Hz polling rate (I use a gaming mouse even if I don't play videogames because I'm very sensitive to input delay).
After a fresh start, with a 1000Hz polling, rate WindowServer goes from ~2% to ~50% CPU usage. Lowering the polling rate to 125Hz (the lowest polling rate I can choose) makes the WindowServer process reach ~20% CPU usage. Doing so also makes my MacBook more silent because the fans don't start as often as when using a higher polling rate (I can't provide "scientific" proof, though, so please take it with a grain of salt).

Then, I tried with two other mice: a Logitech G203 (wired) that produced the same results, and an Amazon Basics wireless mouse (no idea what its polling rate is), which made WindowServer reach ~25% CPU usage.

Finally, I tried and with a Magic Trackpad 2 (which should have a polling rate of ~90Hz) and with the built-in MacBook trackpad, and there were almost no changes to the WindowServer CPU usage.

I'd love to learn why and how Big Sur introduced this issue in macOS... but I feel I'll never know the answer :)

I did my test on two different MacBooks with Big Sure (both producing similar results):

  • MacBook Pro (16-inch, 2019), 2,3 GHz 8-Core Intel Core i9, 16 GB 2667 MHz DDR4, AMD Radeon Pro 5500M 4 GB
  • MacBook Pro (15-inch, 2017), 2,8 GHz Quad-Core Intel Core i7, 16 GB 2133 MHz DDR3, Intel HD Graphics 630 1536 MB