Big Sur terminal sometimes 5-second lag, 16in macbook pro

big surkeyboardterminal

update 5 issue seems to still be happening for another user (see comment in answer below) under macOS 11.2.3.

update 4 Looks like this issue in terminal is no longer happening after updating to 11.2.3. However, there's now a similar issue in Google Chrome where having multiple tabs open and then clicking a tab does nothing, but then moving the cursor will go to that tab (the expected behavior is obviously to go the tab immediately upon clicking the tab). The "Battery" settings under System Preferences now has a checkbox to enable/disable discrete graphics switching (not sure if it was there before) but disabling switching causes the Chrome tab problem to go away.

update 3 This just happened to me again when my macbook was at 100% battery, and plugged in. Is it possible that it's not due to the graphics switching?

Update 2 Looks like this is a known bug with the hybrid graphics of my MBP, as the answer below points out. Here's another thread. Interestingly, I haven't noticed any issues in other apps like Chrome or Safari that much, just in Terminal.

Update I notice that the lag seems to happen only when running on battery. Additionally, I've observed in even when not pressing return, for example when using Vim and just navigating around with hjkl, sometimes a single keypress would seem to not register, but then the second press would "flush" of them, or alternatively waiting about 5 seconds will "flush" the first press.

original

I'm using the default terminal in Big Sur using 2019 16 inch macbook pro. I'm on a clean install, with no changed settings or installed programs. Default shell settings.

Sometimes (maybe once every 15 min or so) when I input a command in terminal (e.g. ls or cd ~/Documents), and when I hit Return on my keyboard, the terminal seems to do nothing. If I press any key again, then the Return "goes through", along with the second key I pressed. Alternatively, if I just wait 5 seconds, the Return "goes through", and everything is fine.

Has anyone else noticed this terminal lag?

Best Answer

Update: confirmed issue still happens as of macOS 11.2 RC3

Exact same behavior here on a 16" 2019 MBP, starting from when I updated to macOS 11.0 and still occurring as of 11.2 beta 2.

Able to reproduce "on demand" by typing "ls" repeatedly in both iTerm2 as well as the built in terminal.app.

Root cause seems to be the Intel graphics driver, as disabling graphics switching or connecting an external monitor (which forces discrete graphics) eliminates the issue at the cost of battery life.