New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
High refresh rate support #6427
Comments
Hello, I feel I have same issue. I recorded Metal Performance HUD: CleanShot.2024-01-25.at.16.33.39.mp4but I was not able to run CPU Profile, it crash every time when I select CPU Profiler in Instruments.app. |
I opened Zed with I'll see if I can get Instruments.app running to get a CPU profile. I need to set up Xcode first though. It does seem like variable refresh rate works though, so maybe worth relabeling this as a bug. |
Here's a trace of me scrolling in Zed: zed-scrolling.trace.zip FWIW, I also opened devtools and did some profiling in vscode. I can confirm that vscode scrolls at a consistent 120fps (~8.3ms per frame). |
Hey @szlend and @oliver-kriska! Thanks for reporting. I've also seen some interesting FPS "problems" in past few days but I can't really track them down. Me and @as-cii looked at your trace (thanks!) but nothing really stood out. We also couldn't reproduce it:
Can you give us some more data points? All of the following might have an influence:
Maybe we can also turn this around: can you open the Also, I know this is asking too much, but if you're in the mood: a phone recording of the Zed on a display being scrolled would be ideal, becaues that way it's easy to see how fast the scroll is (because it's hard to capture on a screenrecording). |
@mrnugget I think I might have figured out how to reproduce this. The scrolling is smooth as long as the editor is open in windowed mode. As soon as I fullscreen it (so it moves to another workspace) it stars lagging again. With the Metal HUD I can see that it switches from Let me know if you're able to reproduce it this way. If not, I can give you more data points as requested, or we can hop on a call. |
Okay, that's very interesting. From what I understand, I still can't reproduce it, even in fullscreen mode. |
|
Another repro here: Zed configuration {
"theme": "Summercamp",
"telemetry": {
"diagnostics": false,
"metrics": false
},
"vim_mode": true,
"ui_font_size": 16,
"buffer_font_size": 16
} File you're scrolling through Display How do you scroll |
When I'm scrolling in Edit: Actually, I think it's the same in |
File you're scrolling through: Display How do you scroll? Zed config``` { "project_panel": { "dock": "right" }, "vim_mode": true, "base_keymap": "VSCode", "show_copilot_suggestions": false, "theme": "Rosé Pine", "buffer_font_size": 15, "buffer_font_family": "Hack", "formatter": "prettier" } ``` I have a VFR 240Hz, 1440p monitor set as fake HiDPI (macOS is rendering in 5K and scaling down to 1440p), so I figured I compare VSCode (Insiders) scrolling with Zed's (I have stable channel version installed). Here's a screen recording with FPS meters in both VSCode and Zed. It doesn't really show the difference, but in person the difference is pretty apparent. The faster I scroll the slower it gets on both editors, but Zed's "baseline", normal speed scrolling is ~70-100fps, while VSCode's is 200-240fps. |
Hmmm, I wonder if that means the issue is in our editor somewhere, rather than in the framework 🤔, thanks for the research @rev4324 |
Hey all! Thanks for the recordings and data everyone. We're still debugging this. The problem is that this is really hard to reliably reproduce. It's also hard to know which measurements are exact and which aren't. Example: Apple's Metal HUD seems like it has a life of its own and sometimes it shows the Hz of the external display on which it's displayed, sometimes it doesn't. VS Code's FPS meter constantly shows 120fps, even if nothing happens on screen. I can say that I can get 120fps to show up on the MBP display when scrolling in Zed, BUT the on_mbp_display.mp4The That's one interesting thing I want to investigate. The other is that it's really hard to reliably reproduce any consistent frame rates: sometimes I get ~60FPS on this external display, sometimes ~80fps, sometimes on the MBP it hovers around 80fps, sometimes around 120fps. The other thing worth mentioning here is: does this maybe have something to do with the scrolling itself and not the FPS? VS Code has a very high scroll speed. It's really easy to just flick on the touchpad and scroll down 400-500 lines, vs. the 250 you get in Zed. So maybe scrolling is involved too. Investigating. If anyone wants to help investigate this further:
|
I tried that branch and it feels same. And hud shows lower FPS, max about 80. Preview shows max about 110 FPS. Frame duration in console is about 5-9 and a few 4, not a lot. So it's a little slower, that's my basic feelings. |
Just dropping more data in here. I took profiles/traces of Zed in Instruments.app, only on the MBP, no external display attached. And, well: we do hit the 8ms pretty consistently. There are some blocking wait times, but as far as I understand everything that's going on that's because the main thread is blocked on events. So these blocks also coincide with me hitting the touch pad to scroll (I have to admit: I learned in the past few days that I'm pretty bad at consistently scrolling fast through a 10k line file a touch pad...) |
I also had noticeable jitter on the 120hz MBP display a couple of days ago (gone today) and it reminded me of neovide/neovide#2102 |
Yup, that's what we have implemented in the |
Little end-of-day-update:
|
|
Whoa, that's really interesting. On my M3 I get variable FPS, up to 120fps, but it's never really exact. I'm going to later try this on the M1 I have here. And yes, the So overall you would say the |
That does look like it's working as intended though, right? FPS is variable between 60 and 120hz here. |
No, the FPS shown is average FPS. If I have one frame rendered at 60fps intervals and two frames rendered at 120fps intervals, then the average framerate is 80fps. Look at the blue spikes in the |
Ah, I see what you're saying. It's not really variable, but only flipping between 60 and 120hz? |
I think it would help provide consistent feedback if you added smooth scrolling to keyboard-activated scroll commands, that way everyone can hold up/down or pgup/pgdn and compare at the same speed, in the same direction. |
@mrnugget Whatever you did in Still feels laggy in fullscreen ( |
@szlend fullscreen feels pretty good as well, but I can't get the hud to show up so I can't tell if it's direct mode or what the real numbers are. |
Another update here: @as-cii @nathansobo @maxbrunsfeld found another fix/improvement here #7253. It's already on |
So for me these ones are smooth now:
|
Yup. I haven't talked to the others since the fix was merged, so I might be off, but I think we have to combine both approaches: |
@szlend I just rebased |
Tried FWIW I rebased |
Oookay, I probably have some very good news here: @as-cii made the latest fix on Can you all try that out and see if you still have the same problem? @haze reported that scrolling is now much better on their M3 Max 14". Previously the blue line in the Metal HUD was jittery (wheras mine was flat with spikes), now it's a lot better. |
Flat blue with spikes on my M1 Max. Feels great. |
Just tried latest preview, and I think the issue is solved. Blue line on mine is flat, with spikes appearing as I touch the trackpad, but I'm not able to feel any chopiness. Pre is around 4ms when I scroll, while GPU is around 2ms. It feels as good as e.g. Finder now, much better than VS Code. |
It would be great if anyone reporting this as fixed could double check their rendering mode with You can launch the Metal HUD from the terminal for any Zed app bundle like so:
Edit: I'm getting as bad as 20fps lows (50ms pre) around line 8750 in types.ts. Everything is fine as soon as I switch to |
For me it's much faster, FPS around 140, measurements log around 2-3ms, previously +5-7ms. CleanShot.2024-02-05.at.09.30.28.mp4 |
Perfect! Then I'm going to close this issue, since everybody seems happy with current |
I cannot exactly tell what it is but on a super-high-end machine (Mac, M3 Max, 96gb ram) with 2 external monitors I do run zed vertically on an LG QHD (not sure if it's anything to do with the monitor here but it's the only monitor I code on so also the only one I experience this with, but next time this appears I'll move it to a different window to see if it makes a difference). Anyway, what happens is an EXTREMELY laggy behaviour (unusably laggy) . But it doesn't happen always, but often. I don't know what happens really, but I wanted to report that this happens . I never had this problem with my M1 Pro Macbook which had 32gb ram. It seems that this high-end machine somehow does something different which causes ZED to fail. Been using ZED as my primary editor lately but this brings me back to VSCode |
Does it go away when you disable the scrollbar? |
hard to tell. I'll try to reproduce it. |
I think that i'm encountering the same issue: while in fullscreen scrolling feels laggy, definitely below 60 fps. When editor not in fullscreen mode - everything is fine. |
That relates. |
Can you try it with |
Sure, i disabled the srollbar and turned on EDIT: d822410c-4e60-4ab6-b100-f6593584914d.mp4 |
Hehe, we've all been there. What you can do is record with your phone or another camera — that's what I did in the past. It helps because it's not mucking with macOS' compositor. |
Tried to record on my phone, had to reduce quality to upload here but i hope the difference can be seen img-3466_Cw84tvnF.mp4 |
Hmmm, I don't see a difference, but I also don't think there's anything we can do here as long as macOS reports 120fps in both modes, which it does here, right? |
Yeah, i'm not sure how could i present this data correctly, so i'll stick to windowed mode for now |
Check for existing issues
Describe the feature
Scrolling through text in Zed feels choppier compared to Visual Studio Code on a high refresh rate display (MacBook Pro M1). It would be great if Zed supported rendering at high (or variable) refresh rates.
I'm not really sure how to verify if this is the case but is rendering capped at 60 fps right now?
If applicable, add mockups / screenshots to help present your vision of the feature
No response
The text was updated successfully, but these errors were encountered: