3 ms·
> I assume zed isn’t doing that either as it would be horribly inefficient. What are you supposed to do instead? Zed uses the GPU. It's not making calls to ret
by LoganDark 3y ago
> I assume zed isn’t doing that either as it would be horribly inefficient.
What are you supposed to do instead? Zed uses the GPU. It's not making calls to retained-mode widgets to individually reposition them, nor is it blitting into a buffer using the CPU. It's using the GPU which eats pixels for breakfast. You've been able to rerender the entire screen each frame for over a decade - just look at Windows 7 Aero, which ran on the laptops of 2009 for the exact same reason: it used the GPU!
- zozbot234 3y agoRerendering each frame is wasteful because it keeps hardware from reaching deeper power-saving states. This includes the CPU, GPU and even the display, due to technologies such as FreeSync. On modern hardware, even removing the blinking cursor has been found to save quite a bit of power, by eliminating needless screen redraws.
- justinclift 3y ago> ... even removing the blinking cursor has been found to save quite a bit of power, by eliminating needless screen redraws. Hadn't heard of that before, but it makes sense now you mention it. :)
- LoganDark 3y agoZed only rerenders the window each time it changes (and also for about a second since the last interaction for reasons[0]) but every time it rerenders the window it does rerender the entire window and not just the area that changed. That's what I thought GGP was calling horribly inefficient. [0]: https://zed.dev/blog/120fps https://zed.dev/blog/120fps
- Rusky 3y agoNeither Windows Aero nor Zed renders every single frame, 120 times per second. The parent comment is correct is correct that the important thing is to be able to render any given frame in 1/120th of a second, but to leave things alone when nothing is changing.
- LoganDark 3y agoZed does do it for about a second following user interaction[0] but I assumed GGP was talking about only redrawing the changed part of the window. Not rendering frames continuously even when nothing is changing at all, which Zed doesn't do (and Windows Aero didn't either, at least to a certain extent). [0]: https://zed.dev/blog/120fps https://zed.dev/blog/120fps
- adastra22 3y agoYou render into a texture once, and then just send that to the compositor each frame as needed.
- LoganDark 3y agoYes, it's just rendering into the texture redraws the entire window and you never really need to worry about redrawing only the parts of the screen that changed. But I think GGP was actually talking about redrawing the window every frame even if nothing's changed at all, which is indeed inefficent (though not necessarily "horribly").
- adastra22 3y agoGGP is me, and yes that’s what I meant. Under no circumstance would zed actually be drawing 120 frames each second, right? That would be 100x more energy usage than would actually be required, and so I think “horribly” is accurate.
- LoganDark 3y ago> GGP is me Oops, thanks for the correction. > Under no circumstance would zed actually be drawing 120 frames each second, right? It does this when scrolling for sure. That's a trivial case where 120 FPS is required on a 120Hz display. It also does this even when nothing on the screen is changing, but only for about 1 second after the last user input. This is explained in a blog post[0]. Now this does cause more power usage, because when Zed does not do this, the display can actually downclock to save power. But downclocking like that increases latency, which is why they prevent it from happening in the middle of user input (but still allow it to happen betwen each burst of input). [0]: https://zed.dev/blog/120fps https://zed.dev/blog/120fps