zed
zed copied to clipboard
Slow tab switching (Zed 0.119.17)
Check for existing issues
- [X] Completed
Describe the bug / provide steps to reproduce it
When simply switching tabs, Zed sometimes does switch instantly like 0.188.1, but most of the time freezes for almost a full second before actually switching to the new tab.
Environment
Zed: v0.119.17 (Zed) OS: macOS 10.15.7 Memory: 16 GiB Architecture: x86_64
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your ~/Library/Logs/Zed/Zed.log
file to this issue.
If you only need the most recent lines, you can run the zed: open log
command palette action to see the last 1000.
Hey @Labrium, thanks for the report! Do you have Instruments.app
installed and, if so, would you mind capturing a CPU Profile while you move across tabs and Zed freezes? We are unable to reproduce this on our machines, so this would be huge to help diagnose what the problem is. Thank you! 🙏
Sure thing. I also just found that switching tabs using the keyboard shortcut does not trigger the freezing, only clicking on the tabs.
From these profiles, it looks like Zed is creating a ton of threads when you click to switch tabs, but not when you use the keybinding, even though using the keybinding increases the CPU usage more: ZedTabSwitchingClick.trace.zip ZedTabSwitchingKeybinding.trace.zip
@Labrium nothing really stands out in the trace. Any timestamp in particular you think we should focus on?
Also: is there anything special about the files you're opening? Are they large? LSP attached?
A screen recording would be ideal, because it's really hard to reproduce this.
EDIT: Another think work trying is to launch Zed with ZED_MEASUREMENTS=1
which will then cause Zed to print the time it takes for frames to render: env ZED_MEASUREMENTS=1 /Applications/Zed.app/Contents/MacOS/zed
You can then post the results here.
https://github.com/zed-industries/zed/assets/76017200/8f4100d8-0d97-4012-b03f-8c6e6ae10a83
Same as this Zed: v0.119.20 (Zed) OS: macOS 12.2.1 Memory: 16 GiB Architecture: arm
@Labrium thanks! Wow, that's interesting. Exactly 1s frames. Sadly I can't see those blocks in the traces you provided.
Could you maybe re-record a trace but this time add the Thread State Trace
instrument? To do, you need to hit the +
in the top right corner of Instruments.app
and add it. Like this:
That will then record a trace showing what each thread was doing. Ideally we'd see the 1s show up somewhere.
@mrnugget I was about to record that trace for you, but it looks like this issue is completely fixed in Zed 0.121.5!
Ha! Well, I wish I knew what it was, but I'll take a closed issue :)