Performance degradation over time + accelerated repro #11799
Unanswered
bearcage
asked this question in
Issue Triage
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Issue Description
tl;dr unfocus/focus ghostty in a loop, watch send-rights climb on one port in lsmp
I noticed a significant gradual performance decline on an M3 max macbook with ghostty, safari, discord, and activity monitor and nothing else open. This first happened after not exiting ghostty for quite some time while doing ordinary work, so I started fishing for reasons why it might be slowing down.
I also had a decent chunk of cpu time on the system spent in WindowServer (in compositing tasks, per
sampleoutput), which cleared up on a reboot, so initialy I figured maybe unrelated, maybe red herring, maybe I just got unlucky, but it turns out actually this might be related.Trying to see if I could reproduce the ghostty slowdown, I tried to think of things that I do in regular use which might provoke state changes — connecting and disconnecting external displays, sleeping and waking, alt-tabbing, copying/pasting, etc. I figured some of those I can artificially speed up, so I started with the easiest of those, alt-tabbing, and hit on something that looks legit. If you use applescript to slam unfocus/focus in a hot loop, you can pretty quickly reproduce the state I got in to.
The only thing I was able to dig up poking at the process which pointed to resource exhaustion or leaking (I'm not exactly a macOS expert, linux is my day job) was what looks like an ever-growing number of send-rights on one mach port in lsmp for ghostty.
Expected Behavior
Ideally not slow down
Actual Behavior
The whole system gets slow after a while of this abuse, in a way that doesn't seem to happen when doing the same to Safari or Apple's Terminal.app
Reproduction Steps
osascript -e 'repeat 4000 times' -e 'tell application "Finder" to activate' -e 'tell application "Ghostty" to activate' -e 'end repeat'As you go along, watch WindowServer's CPU load, and notice the frequency of flicker in window decoration focus display getting more uneven over time. Also note the system getting a little less predictably-instant doing things like switching focus to other applications (in between runs above, of course).
After a couple rounds of this, I'm able to get WindowServer's cpu load up to the mid-60% (with nothing going in ghostty, just a shell waiting for input). When you quit ghostty, WindowServer's cpu load will drop, but not to a normal idle-system level (mine in my latest run of these steps went from 68% to ~25%, and back up to 30% when I reopened ghostty to idle it).
Ghostty Logs
Ghostty Version
OS Version Information
macOS Tahoe 26.3.1 (a)
(Linux only) Display Server
None
(Linux only) Desktop Environment/Window Manager
No response
Minimal Ghostty Configuration
N/A — I only have a theme and shell-integration-features=ssh-env, neither of which should be related.aAdditional Relevant Configuration
No response
I acknowledge that:
```) on separate lines.EDIT: deleted redundancy — turns out typing on a machine that's slowed to a crawl is a bit of a struggle.
Beta Was this translation helpful? Give feedback.
All reactions