Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

Hot take: retained-mode was a premature optimization. We built Membrane using rust and egui and never looked back. When our IDE was react-based we had to worry about reflows and re-renders. With immediate-mode every frame is a re-render! But it only takes 900us

89,828 görüntüleme • 1 yıl önce •via X (Twitter)

10 Yorum

Juan Campa profil fotoğrafı
Juan Campa1 yıl önce

Retained-mode made sense when GPUs didn't exist but these days virtually every device has a powerful enough GPU to continually paint what amounts to a bunch of rectangles.

static_assert(false) profil fotoğrafı
static_assert(false)1 yıl önce

Nice UI! … now let’s see the battery life

Juan Campa profil fotoğrafı
Juan Campa1 yıl önce

It uses 0.9ms out of 16.6ms which translates to ~6% usage of a single CPU core! I’m okay with that. (assuming 60hz display, double for 120hz) GPU might actually be less than DOM-based apps because there’s no layer compositor. I haven’t measured though. Everything is rendered in a single pass. It does nothing while idle or backgrounded. Only when being interacted with.

WerWolv profil fotoğrafı
WerWolv1 yıl önce

Had the exact same experience when making ImHex! Immediate Mode is great. I did make one optimization though. By default we render at the screen refresh rate but if the window isn't focused or no input events have happened for a few seconds, we lower it to 5 FPS

Patryk Zoltowski profil fotoğrafı
Patryk Zoltowski1 yıl önce

This maybe makes sense for some desktop apps but definitely not for mobile apps or OS ui - would drain battery too much. Imagine all windows OS gui and apps written in immediate mode and battery would be dead much faster.

____ _____ profil fotoğrafı
____ _____1 yıl önce

Look into lazy evaluation! You can use an immediate mode API with retained mode performance if you do it right. That's what I did on my own project at least.

Juan Campa profil fotoğrafı
Juan Campa1 yıl önce

Isn’t that exactly what react does?

Johannes Schickling profil fotoğrafı
Johannes Schickling1 yıl önce

Damn this UI looks awesome!

Patrick Smith profil fotoğrafı
Patrick Smith1 yıl önce

React is a retained virtual DOM because the other retained system, the DOM, has a slow API. Which is then transformed by the browser into another retained layout tree, and that into a retained paint tree. It’s multiple levels of retained.

Johann Woelper profil fotoğrafı
Johann Woelper1 yıl önce

I did the same with my image viewer: Never looked back. The most important part is that UI is fun again now.

Benzer Videolar