I am constantly surprised how few mentions of Slint there are in these sorts of articles. It's written by a team of funded ex-Qt alumni, is incredibly fast, and their DSL approach, while having a bit of a learning curve, makes laying out apps and managing data binding incredibly easy.
They also bypass a big part of the issues mentioned in the article by just straight up using skia as a renderer on desktop (you can use others if you want) which gives software and gpu accelerated paths.
I'm not associated with the project at all, but have been using it on and off for a couple years and have been quite satisfied.
It's main weakness is rich text rendering which lacks maturity for complex layouts, but it is getting better all the time.
Could you elaborate on what you mean by resource hungry? What kind of application and hardware are you using, and what resource usage are you seeing?
I'd genuinely like to understand your experience. It might be a bug or something we can improve. (I work at Slint)
For context, Slint is designed to be lightweight. Especially compared to shipping an entire browser runtime, which appear to be considered normal by many.
They are not free. That's a pretty big barrier to adoption. When QT was launched there was no good alternative for cross platform if you want to support Linux.
Honestly, if Slint doesn't pivot or provide non GUI lib services, I would expect an "Our Incredible Journey" blog post soon.
The only way I can imagine them surviving is to go into aerospace and automobile where the barriers are entry are mostly around certification and compliance. There's no moat anymore in consumer UI libs.
On desktop and mobile, they're free for open source products and for any company with less than $2M in funding or revenue, and pretty reasonably priced otherwise.
Embedded seems to be where they're focusing, as they do charge royalties for that, so you may be right.
The "2026 Survey of Rust GUI Libraries" does not include Native Shell (nsh) [1] which is retained-mode and based on gpui-fast.
Maybe because the code repository was started on October 11th, just 1.5 months ago. More than 2,000 commits later it already looks great. I think, they do the (AI) software engineering part very well [2].
After using GTK and JavaFX, and React for a decade, Native Shell makes me really excited. I never got warm with Flutter, the desktop applications were very slow on my MacBook. So I've been doing frontend development for more than 25 years, and I'm completely mind-blown for the last few weeks.
Having a React background this feels very familiar, without the annoyances. Reactivity is inspired by Solid, styling by CSS (optionally with Tailwind syntax), the UI primitives are native views with layouting done by Taffy [3]. If you target web, the UI will be HTML. You can write the UI screens and components in Rust, but you can also use TypeScript/JSX, it will transpile and interpret it using Rolldown and QuickJS.
It includes some components which are difficult to get right. A data table component, a rich-text editor component, and a plot component. As far as I can tell, they chose the currently best-known approach for them.
I'm building a custom GUI in Rust and it is such a slow process to build out. I find bits of the end result to be amazing, but it's all in the details that look like nothing compared to using something more "complete" with a larger UI community.
I have some nice markdown rendering and phenomenally fast smooth scrolling - but I look at everything ahead of me, I don't even have text selection implemented yet, text wrapping and input cursor placement implementation wasn't that smooth to begin with. I have some amazing shader based animations, but the amount of effort that went into far exceed anything else I could have picked for a foundation.
I started with Typescript and kept running into performance issues - it was fast to build and easy to scale, but kept becoming harder to maintain. With Rust it feels hard to build, hard to scale, but it feels like scaling and maintaining might be starting to get easier. The performance ceiling is a night a day difference though.
I found Qts signal/slot system very nice to work with to help with bridging the application logic to UI events and flows. Maybe rust's generic async is all you need, but I suspect that a GUI should probably have some opinion of how it interacts with async.
I recently saw a presentation from Matthias Rauter who is actively working on Qt bridges specifically for Rust.
So in theory you could have your business logic in Rust and shoehorn a full blown QT frontend.
I am not sure if it's production ready and they are certainly open to feedback from industry but it is definitely a path forward if you want to leverage all the conformity/compliance aspects that QT already worked out through the years.
I was actually thinking the most rust ui crates Ive tried don't have an equivalent to signal/slots. This article focused on the rendering aspects, rightly so. But there are other untouched areas to explore for rust ui libraries
What is wrong with Dart? I genuinely want to understand why such a framework exist in the first place? Why would someone write UI in Rust? That too in a framework meant for Dart with excellent ecosystem.
Performance? What is that one problem that Rust solves that Dart cannot?
If this is for fun. Great. But if this is seriously taken to prod, well.
"You really want a video playing in a hardware accelerated layer when possible, and on low end devices it’s the only hope for getting smooth frame rates."
I hit this recently trying to play video in Bevy efficiently.
I thought that must be easy,
but ended up with frames copied into a texture and composited by the engine, because the app owns just one swapchain and the video can't get its own layer.
When I made a computer use tool on macOS, my tool could find the right button easily, because well made apps have buttons with a role and a name.
But I made my tool find the right button using screenshots at bad apps.
> The reasons for slow adoption may be melting away. Writing Rust code is harder than languages more traditionally used for UI (TypeScript, Kotlin, Swift), and finding engineers skilled in both Rust and UI is challenging. But AI is changing the game. There’s evidence that the LLM cost of writing Rust code is not significantly higher than other languages, and there is reason to believe that in large codebases, Rust will be more maintainable because its type system helps enforce invariants. So if all languages have roughly the same cost, then why not go with one that has a dramatically better combination of safety and performance?
IOW, you're not going to write nor read any code, so choose Rust.
(Of course, if you're not going to write nor read any code, you might as well choose anything).
Native in this context refers to the UI toolkit(s) native to the platform. Microsoft has a big list of them, with different visual styles, and applications are split between them.
I think the Rust GUI scene is fast catching up. After using ArtCraft on my PC, I was amazed at the responsiveness and expressiveness of the GUIs being implemented and I feel they've come a long way. I was used to running slow JS based apps all the time, any of these native ones feel like an upgrade to me.
Having said that, I think we've come to an era where concerns like these can be quickly addressed and responsiveness tested, so looking forward to more of this kind of analysis and more usable applications in the near future.
ArtCraft mostly uses egui and without egui there isn't much that would be considered mature, even GPUI doesn't seem to have the same level of completeness.
I suppose what I'm getting at is there isn't much more movement that I've noticed as far as professional UI development. I thought there would be a lot more than there is.
Concur. I started with EGUI years ago when there were fewer options. It still seems to be one of the most mature, reliable, and flexible. I'm happy continuing to use it for new projects, with an open mind towards experimenting with GPUI and others.
> That’s been playing out architecturally in the choice between immediate mode and retained mode. Immediate mode is very appealing because it’s less total code and seems quite a bit simpler. And for some applications (most especially development support for games) it works well. However, I am concerned it won’t scale especially well. In short, it’s good at the first 90%, but it makes the second 90% harder. To be considered really production-ready, it has to establish stable widget identities to build and update the accessibility tree, and it has to reliably cache expensive intermediate artifacts such as text layouts (simple immediate mode often gets around this by cutting corners in text layout, which may be fine for gamedev). And of course, it pulls strongly towards a model of re-rendering everything every frame rather than exploiting layers in the compositor.
It's a common criticism but I don't think it's based on anything other than preconceived notions about rendering being slow and doing a ton of caching makes everything faster. but neither seem to be backed up by any sort of empirical evidence. Anecdotally every imgui I've used has been lightening fast, and retained mode UI's like the browser, windows software, new Macos apps written in SwiftUI, etc, have performance problems.
Egui has solved the accessibility problem and does a lot of caching: galleys, glyphs, and layouts are cached, packed texture atlases minimize GPU uploads, and it uses inputs & animation state to draw on demand.
I also don't see how retained mode UI would scale better. Retained mode UI's are typically slow - they have a complex multi-pass general layout system and a ton of bookkeeping, which is why you typically need to keep updates to a minimum and ever-more-complex change tracking systems are being built to reduce updates to a minimum. This doesn't scream scalability to me - whereas in an imgui there is a baseline overhead but adding more widgets or more frequent updates have a negligible performance impact. the worst case for retained mode is a UI which has many widgets frequently updating multiple times a second, which means you approach the update and drawing of imgui but with the additional overhead of the change tracking, bookkeeping, etc of the retained system.
Also there is nothing fundamental about imgui layout systems being limited, and in my experience it's not that difficult to build custom widgets to implement pretty much anything. Retained mode layout systems are usually declarative, where you describe a layout and hope that the system is flexible enough to support what you want, whereas with an imgui you can just directly draw and shade geometry to get whatever you want.
Otherwise, great article and I look forward to the future of Rust UI.
The point I'm making is a subtle one. I do think you can go very far with an immediate mode GUI paradigm, and it's also certainly the case that most of the imguis you see are performant. But I still wouldn't choose it for a design or productivity app.
Once you do all the caching of text layouts and building of intermediate trees for a11y, you no longer have a pure imgui, but rather a hybrid.
I'm going to try to get this point across in an analogy, apologies to people not familiar with the referent.
Let's say you're frustrated with the size and complexity of a modern C compiler like clang or gcc, and want to do something simpler. One of the design decisions is whether use SSA (static single assignment) as the basis for the intermediate representation. If you're going for simplicity, you might quite reasonably choose to skip it; you can generate reasonably good code straight from the AST.
But then, you and your users get dissatisfied with merely reasonably good code, and want some of those optimizations that make production compilers generate actually fast code – constant folding, common subexpression elimination, strength reduction, etc. You can certainly implement them as AST transforms, but it gets difficult to track everything? You add a bunch of logic and eventually get those optimizations to work about as well as the SSA-based version in real compilers.
Another compiler designer has similar goals but uses a different strategy: dive in and do SSA from the beginning, which is not as simple at first, but then you can just do those optimizations "from the book," without a lot of friction.
Basically what I'm saying is that I prefer the second compiler. It's not to say the first can't be made to work.
I guess it depends what you define as an "imgui". To me, I think it's when the application describes the UI every frame. I don't think purity of approach is very relevant though. I'm happy to concede that a hybrid approach is better - in all things, balance :)
If I understand the point of the analogy, it's basically that when you bolt sophisticated optimizations onto a representation that wasn't designed for them, the bookkeeping accumulates in an ad hoc way, while a representation purpose built for those transforms makes the same optimisations feel like they fall out of the structure. Would that be valid?
If so I would actually swap imgui's and retained mode ui's around. In an imgui, you can implement domain-specific caching and other performance optimisations for your bottlenecks, whereas in retained mode UI you're building against a general system and you often need to resort to hacks to rescue performance, or design your data model in a way that is amenable to change detection. Memoization, keys and identity gymnastics, state sliced into atoms/signals/items, "this component only depends on X" annotations, Equatable conformances, Identifiable fake IDs, keeping structs small and pruned so the diff is cheap, splitting views so diff granularity lines up with actual change granularity, id resets to force identity, etc. Fixing performance in React is largely about reshaping your data model until it's legible to the framework's change detection. When you use fine-grained reactive systems you need to adopt the framework's data stores and it ends up infecting your entire application. You cannot just pull in a dependency and use it's state directly - you need to martial it into signals or stores or set up subscribers.
Whereas in an imgui it's trivial to benchmark and if you notice that a list is performing a lot of work on each update cycle you can apply an optimisation that is impossible in a more general system.
SSA isn't simply a retained representation of an AST. It's a representation with properties that make particular analyses and transformations easier. What specific properties of a retained mode UI representation make the important operations of a design application easier, and what is the cost of obtaining those properties? If the answer is stable widget identity, incremental invalidation, persistent layout relationships, and accessibility object lifetimes, thats fine, but an immediate-mode system can introduce those capabilities selectively, without necessarily adopting the entire retained-mode programming model.
In other words, the question isn't whether you need the equivalent of SSA, it's if you need to make SSA the foundation of your entire application.
Fwiw I'm building a desktop application with Egui and Bevy and it's been a breath of fresh air compared to building applications with classical retained-mode systems. An entire class of bugs and complexity regarding state management just goes away. Performance is ~3ms including the entire render pass (more than just UI), and all of the complex components that required caching and other performance optimisations would have had to be hand-rolled in a retained-mode system anyways - except with Egui those optimisations are simple to build. All of the state just lives in Bevy's ECS without any real considerations for the UI, because the UI systems can just reach into the world and read it directly. Some parts of the UI live as entities with relationships forming a tree, so you might say that's approaching a retained-mode system, but it's implemented selectively where it's useful - most of the UI is transient.
But to each their own - some people seem to "click" more with a retained mode approach and it's still a valid choice to use it if you prefer it.
First you complain about lack of empirical evidence in discussions about rendering, and then you yourself argue against retained mode UIs using purely anecdotal evidence.
You are also often comparing imgui/egui - a specific implementation of the immediate mode concept to the whole concept of retained mode UI.
> in an imgui [...] adding more widgets or more frequent updates have a negligible performance impact
Absolute nonsense.
> Retained mode [...] hope that the system is flexible enough to support what you want, whereas with an imgui you can just directly draw and shade geometry
At least in browsers you can just use <canvas> or <svg>. If you're implementing retained mode in a custom application - well it also must have some way to draw things on the screen.
I'm not arguing against retained mode UI systems, I'm arguing that some of the criticisms of imgui's are unfounded. A lack of empirical evidence is relevant for that.
I used Egui as an example because that's relevant to the shared article. When I say "imgui" I am talking about the paradigm, not Dear Imgui.
In manu retained mode UI systems you can break out of the paradigm with a Canvas element, but that is quite different from an imgui - it's akin to using a 2d drawing API like Skia.
> RAM remains expensive and the focus is shifting to mobile, so bloat has real consequences. Building high-performance UI in Rust is a practical alternative.
The blogger is making the mistake of trying to come up with problems where Rust is the solution.
The truth of the matter is that both Android and iOS have native, high performance GUI toolkits. Yet, some mobile apps developed by sizeable professional teams led by smart software engineers still opt to develop them with webview-based technologies. Why would this happen if the blogger's argument was grounded on reality?
The truth of the matter is that webview-based technologies are already quite performant and run well with the resources of your average phone. Native GUI toolkits moreso.
Also, today's mobile phones have far more computational resources than your average workstation from 20 years ago, and back then people were fine with using Java-based desktop applications. So to claim that today there is a premium for performance that didn't existed decades ago is an extraordinary claim that is not really supported by reality.
But again that's why the blogger had to at least try to come up with a problem where Rust for GUI programming was a reasonable solution. It's a shame the problem simply isn't real.
Arguing about coding languages seems quite passé. If there is an imperative reason to use something for performance reasons, I’ll bite. Otherwise, it seems silly. The prompts will not differ much and the rewrites are trivial. What matters to me is the experience, not the tech.
I completely agree. I stopped caring about programming languages now that AI writes all the code. And AI’s are really good at C++ so that’s my weapon of choice.
But there are more mature languages that are in the same performance class as Rust (e.g. C++, ObjC, Swift). Rust with an immature toolkit may be worse than WinUI + C++ or SwiftUI + Swift.
All of these languages have their own drawbacks that Rust doesn't. C++ is a toolchain management nightmare, ObjC is antique, and Swift's core team was called "toxic" by Lattner himself.
Which is not to say that Rust is a perfect language (especially for GUIs) but it's no wonder we ended up in this situation. The 14 competing standards all drove themselves into a lake.
If you have multiple megabytes of RAM, the language you use for GUI-related activity is basically meaningless in terms of performance. Other factors dominate massively.
It is possible to write software that conserves memory in almost any language. It’s easier in some languages than others. But AI makes it so that the difference between languages matters less.
I am constantly surprised how few mentions of Slint there are in these sorts of articles. It's written by a team of funded ex-Qt alumni, is incredibly fast, and their DSL approach, while having a bit of a learning curve, makes laying out apps and managing data binding incredibly easy.
They also bypass a big part of the issues mentioned in the article by just straight up using skia as a renderer on desktop (you can use others if you want) which gives software and gpu accelerated paths.
I'm not associated with the project at all, but have been using it on and off for a couple years and have been quite satisfied.
It's main weakness is rich text rendering which lacks maturity for complex layouts, but it is getting better all the time.
> It's written by a team of funded ex-Qt alumni, is incredibly fast
I don’t know how you define fast, but slint is incredibly resource hungry on desktop.
Could you elaborate on what you mean by resource hungry? What kind of application and hardware are you using, and what resource usage are you seeing?
I'd genuinely like to understand your experience. It might be a bug or something we can improve. (I work at Slint)
For context, Slint is designed to be lightweight. Especially compared to shipping an entire browser runtime, which appear to be considered normal by many.
They are not free. That's a pretty big barrier to adoption. When QT was launched there was no good alternative for cross platform if you want to support Linux.
Honestly, if Slint doesn't pivot or provide non GUI lib services, I would expect an "Our Incredible Journey" blog post soon.
The only way I can imagine them surviving is to go into aerospace and automobile where the barriers are entry are mostly around certification and compliance. There's no moat anymore in consumer UI libs.
On desktop and mobile, they're free for open source products and for any company with less than $2M in funding or revenue, and pretty reasonably priced otherwise.
Embedded seems to be where they're focusing, as they do charge royalties for that, so you may be right.
Small correction: Slint is free for proprietary desktop, mobile and web apps under our Royalty-free license, regardless of company size.
> by just straight up using skia
I think building up on wgpu is better
wgpu is unusable without a modern GPU, unlike skia.
If you mean "modern" as in from within the last 15-20 years then yes. It targets both WebGL2 and OpenGL, in addition to Metal and Vulkan.
The "2026 Survey of Rust GUI Libraries" does not include Native Shell (nsh) [1] which is retained-mode and based on gpui-fast.
Maybe because the code repository was started on October 11th, just 1.5 months ago. More than 2,000 commits later it already looks great. I think, they do the (AI) software engineering part very well [2].
After using GTK and JavaFX, and React for a decade, Native Shell makes me really excited. I never got warm with Flutter, the desktop applications were very slow on my MacBook. So I've been doing frontend development for more than 25 years, and I'm completely mind-blown for the last few weeks.
Having a React background this feels very familiar, without the annoyances. Reactivity is inspired by Solid, styling by CSS (optionally with Tailwind syntax), the UI primitives are native views with layouting done by Taffy [3]. If you target web, the UI will be HTML. You can write the UI screens and components in Rust, but you can also use TypeScript/JSX, it will transpile and interpret it using Rolldown and QuickJS.
It includes some components which are difficult to get right. A data table component, a rich-text editor component, and a plot component. As far as I can tell, they chose the currently best-known approach for them.
[1] https://nsh.dev/ [2] https://github.com/longbridge/nsh/commits/main [3] https://nsh.dev/elements/
I'm building a custom GUI in Rust and it is such a slow process to build out. I find bits of the end result to be amazing, but it's all in the details that look like nothing compared to using something more "complete" with a larger UI community.
I have some nice markdown rendering and phenomenally fast smooth scrolling - but I look at everything ahead of me, I don't even have text selection implemented yet, text wrapping and input cursor placement implementation wasn't that smooth to begin with. I have some amazing shader based animations, but the amount of effort that went into far exceed anything else I could have picked for a foundation.
I started with Typescript and kept running into performance issues - it was fast to build and easy to scale, but kept becoming harder to maintain. With Rust it feels hard to build, hard to scale, but it feels like scaling and maintaining might be starting to get easier. The performance ceiling is a night a day difference though.
> Immediate vs retained mode
> For this reason among others, I am not impressed by the choice of the ArtCraft projects to use egui
ArtCraft apps are so snappy and have convinced me that the stigma about immediate mode is irrelevant in most cases.
I found Qts signal/slot system very nice to work with to help with bridging the application logic to UI events and flows. Maybe rust's generic async is all you need, but I suspect that a GUI should probably have some opinion of how it interacts with async.
I recently saw a presentation from Matthias Rauter who is actively working on Qt bridges specifically for Rust.
So in theory you could have your business logic in Rust and shoehorn a full blown QT frontend.
I am not sure if it's production ready and they are certainly open to feedback from industry but it is definitely a path forward if you want to leverage all the conformity/compliance aspects that QT already worked out through the years.
I was actually thinking the most rust ui crates Ive tried don't have an equivalent to signal/slots. This article focused on the rendering aspects, rightly so. But there are other untouched areas to explore for rust ui libraries
I just use Flutter for the UI and then use https://cjycode.com/flutter_rust_bridge/
What is wrong with Dart? I genuinely want to understand why such a framework exist in the first place? Why would someone write UI in Rust? That too in a framework meant for Dart with excellent ecosystem.
Performance? What is that one problem that Rust solves that Dart cannot?
If this is for fun. Great. But if this is seriously taken to prod, well.
Bridges give me bad memories of React Native. There's a reason why they moved away from that - it was terrible for performance.
Or do as Mitcad does: use C++ to talk to Qt, and do the rest in Rust.
Yeah, I don't get it. What is wrong with Qt plus Rust bindings? At this point, is there a more mature cross-platform GUI toolkit?
The traditional model of mutable trees of objects that use heavy inheritance is a rough fit for Rust.
"You really want a video playing in a hardware accelerated layer when possible, and on low end devices it’s the only hope for getting smooth frame rates."
I hit this recently trying to play video in Bevy efficiently. I thought that must be easy, but ended up with frames copied into a texture and composited by the engine, because the app owns just one swapchain and the video can't get its own layer.
When I made a computer use tool on macOS, my tool could find the right button easily, because well made apps have buttons with a role and a name. But I made my tool find the right button using screenshots at bad apps.
> The reasons for slow adoption may be melting away. Writing Rust code is harder than languages more traditionally used for UI (TypeScript, Kotlin, Swift), and finding engineers skilled in both Rust and UI is challenging. But AI is changing the game. There’s evidence that the LLM cost of writing Rust code is not significantly higher than other languages, and there is reason to believe that in large codebases, Rust will be more maintainable because its type system helps enforce invariants. So if all languages have roughly the same cost, then why not go with one that has a dramatically better combination of safety and performance?
IOW, you're not going to write nor read any code, so choose Rust.
(Of course, if you're not going to write nor read any code, you might as well choose anything).
>Windows still has no clear native choice
Wait, where did MFC go?
EDIT: https://zendevy.com/en/tech/mfc-history-and-current-status-2...
Native in this context refers to the UI toolkit(s) native to the platform. Microsoft has a big list of them, with different visual styles, and applications are split between them.
I quite like the Crux approach which uses native UI (mobile, desktop as well) as well as Iced for desktop/web, both of which use the Elm architecture.
I think the Rust GUI scene is fast catching up. After using ArtCraft on my PC, I was amazed at the responsiveness and expressiveness of the GUIs being implemented and I feel they've come a long way. I was used to running slow JS based apps all the time, any of these native ones feel like an upgrade to me.
Having said that, I think we've come to an era where concerns like these can be quickly addressed and responsiveness tested, so looking forward to more of this kind of analysis and more usable applications in the near future.
ArtCraft mostly uses egui and without egui there isn't much that would be considered mature, even GPUI doesn't seem to have the same level of completeness.
I suppose what I'm getting at is there isn't much more movement that I've noticed as far as professional UI development. I thought there would be a lot more than there is.
Concur. I started with EGUI years ago when there were fewer options. It still seems to be one of the most mature, reliable, and flexible. I'm happy continuing to use it for new projects, with an open mind towards experimenting with GPUI and others.
Nice article, thank you for sharing it.
I do want to nitpick this part however:
> That’s been playing out architecturally in the choice between immediate mode and retained mode. Immediate mode is very appealing because it’s less total code and seems quite a bit simpler. And for some applications (most especially development support for games) it works well. However, I am concerned it won’t scale especially well. In short, it’s good at the first 90%, but it makes the second 90% harder. To be considered really production-ready, it has to establish stable widget identities to build and update the accessibility tree, and it has to reliably cache expensive intermediate artifacts such as text layouts (simple immediate mode often gets around this by cutting corners in text layout, which may be fine for gamedev). And of course, it pulls strongly towards a model of re-rendering everything every frame rather than exploiting layers in the compositor.
It's a common criticism but I don't think it's based on anything other than preconceived notions about rendering being slow and doing a ton of caching makes everything faster. but neither seem to be backed up by any sort of empirical evidence. Anecdotally every imgui I've used has been lightening fast, and retained mode UI's like the browser, windows software, new Macos apps written in SwiftUI, etc, have performance problems.
Egui has solved the accessibility problem and does a lot of caching: galleys, glyphs, and layouts are cached, packed texture atlases minimize GPU uploads, and it uses inputs & animation state to draw on demand.
I also don't see how retained mode UI would scale better. Retained mode UI's are typically slow - they have a complex multi-pass general layout system and a ton of bookkeeping, which is why you typically need to keep updates to a minimum and ever-more-complex change tracking systems are being built to reduce updates to a minimum. This doesn't scream scalability to me - whereas in an imgui there is a baseline overhead but adding more widgets or more frequent updates have a negligible performance impact. the worst case for retained mode is a UI which has many widgets frequently updating multiple times a second, which means you approach the update and drawing of imgui but with the additional overhead of the change tracking, bookkeeping, etc of the retained system.
Also there is nothing fundamental about imgui layout systems being limited, and in my experience it's not that difficult to build custom widgets to implement pretty much anything. Retained mode layout systems are usually declarative, where you describe a layout and hope that the system is flexible enough to support what you want, whereas with an imgui you can just directly draw and shade geometry to get whatever you want.
Otherwise, great article and I look forward to the future of Rust UI.
Thanks.
The point I'm making is a subtle one. I do think you can go very far with an immediate mode GUI paradigm, and it's also certainly the case that most of the imguis you see are performant. But I still wouldn't choose it for a design or productivity app.
Once you do all the caching of text layouts and building of intermediate trees for a11y, you no longer have a pure imgui, but rather a hybrid.
I'm going to try to get this point across in an analogy, apologies to people not familiar with the referent.
Let's say you're frustrated with the size and complexity of a modern C compiler like clang or gcc, and want to do something simpler. One of the design decisions is whether use SSA (static single assignment) as the basis for the intermediate representation. If you're going for simplicity, you might quite reasonably choose to skip it; you can generate reasonably good code straight from the AST.
But then, you and your users get dissatisfied with merely reasonably good code, and want some of those optimizations that make production compilers generate actually fast code – constant folding, common subexpression elimination, strength reduction, etc. You can certainly implement them as AST transforms, but it gets difficult to track everything? You add a bunch of logic and eventually get those optimizations to work about as well as the SSA-based version in real compilers.
Another compiler designer has similar goals but uses a different strategy: dive in and do SSA from the beginning, which is not as simple at first, but then you can just do those optimizations "from the book," without a lot of friction.
Basically what I'm saying is that I prefer the second compiler. It's not to say the first can't be made to work.
I guess it depends what you define as an "imgui". To me, I think it's when the application describes the UI every frame. I don't think purity of approach is very relevant though. I'm happy to concede that a hybrid approach is better - in all things, balance :)
If I understand the point of the analogy, it's basically that when you bolt sophisticated optimizations onto a representation that wasn't designed for them, the bookkeeping accumulates in an ad hoc way, while a representation purpose built for those transforms makes the same optimisations feel like they fall out of the structure. Would that be valid?
If so I would actually swap imgui's and retained mode ui's around. In an imgui, you can implement domain-specific caching and other performance optimisations for your bottlenecks, whereas in retained mode UI you're building against a general system and you often need to resort to hacks to rescue performance, or design your data model in a way that is amenable to change detection. Memoization, keys and identity gymnastics, state sliced into atoms/signals/items, "this component only depends on X" annotations, Equatable conformances, Identifiable fake IDs, keeping structs small and pruned so the diff is cheap, splitting views so diff granularity lines up with actual change granularity, id resets to force identity, etc. Fixing performance in React is largely about reshaping your data model until it's legible to the framework's change detection. When you use fine-grained reactive systems you need to adopt the framework's data stores and it ends up infecting your entire application. You cannot just pull in a dependency and use it's state directly - you need to martial it into signals or stores or set up subscribers.
Whereas in an imgui it's trivial to benchmark and if you notice that a list is performing a lot of work on each update cycle you can apply an optimisation that is impossible in a more general system.
SSA isn't simply a retained representation of an AST. It's a representation with properties that make particular analyses and transformations easier. What specific properties of a retained mode UI representation make the important operations of a design application easier, and what is the cost of obtaining those properties? If the answer is stable widget identity, incremental invalidation, persistent layout relationships, and accessibility object lifetimes, thats fine, but an immediate-mode system can introduce those capabilities selectively, without necessarily adopting the entire retained-mode programming model.
In other words, the question isn't whether you need the equivalent of SSA, it's if you need to make SSA the foundation of your entire application.
Fwiw I'm building a desktop application with Egui and Bevy and it's been a breath of fresh air compared to building applications with classical retained-mode systems. An entire class of bugs and complexity regarding state management just goes away. Performance is ~3ms including the entire render pass (more than just UI), and all of the complex components that required caching and other performance optimisations would have had to be hand-rolled in a retained-mode system anyways - except with Egui those optimisations are simple to build. All of the state just lives in Bevy's ECS without any real considerations for the UI, because the UI systems can just reach into the world and read it directly. Some parts of the UI live as entities with relationships forming a tree, so you might say that's approaching a retained-mode system, but it's implemented selectively where it's useful - most of the UI is transient.
But to each their own - some people seem to "click" more with a retained mode approach and it's still a valid choice to use it if you prefer it.
Egui solving accessibility is news to me. Has something changed in the last year or two?
First you complain about lack of empirical evidence in discussions about rendering, and then you yourself argue against retained mode UIs using purely anecdotal evidence.
You are also often comparing imgui/egui - a specific implementation of the immediate mode concept to the whole concept of retained mode UI.
> in an imgui [...] adding more widgets or more frequent updates have a negligible performance impact
Absolute nonsense.
> Retained mode [...] hope that the system is flexible enough to support what you want, whereas with an imgui you can just directly draw and shade geometry
At least in browsers you can just use <canvas> or <svg>. If you're implementing retained mode in a custom application - well it also must have some way to draw things on the screen.
I'm not arguing against retained mode UI systems, I'm arguing that some of the criticisms of imgui's are unfounded. A lack of empirical evidence is relevant for that.
I used Egui as an example because that's relevant to the shared article. When I say "imgui" I am talking about the paradigm, not Dear Imgui.
In manu retained mode UI systems you can break out of the paradigm with a Canvas element, but that is quite different from an imgui - it's akin to using a 2d drawing API like Skia.
> Absolute nonsense.
How so?
> RAM remains expensive and the focus is shifting to mobile, so bloat has real consequences. Building high-performance UI in Rust is a practical alternative.
The blogger is making the mistake of trying to come up with problems where Rust is the solution.
The truth of the matter is that both Android and iOS have native, high performance GUI toolkits. Yet, some mobile apps developed by sizeable professional teams led by smart software engineers still opt to develop them with webview-based technologies. Why would this happen if the blogger's argument was grounded on reality?
The truth of the matter is that webview-based technologies are already quite performant and run well with the resources of your average phone. Native GUI toolkits moreso.
Also, today's mobile phones have far more computational resources than your average workstation from 20 years ago, and back then people were fine with using Java-based desktop applications. So to claim that today there is a premium for performance that didn't existed decades ago is an extraordinary claim that is not really supported by reality.
But again that's why the blogger had to at least try to come up with a problem where Rust for GUI programming was a reasonable solution. It's a shame the problem simply isn't real.
Arguing about coding languages seems quite passé. If there is an imperative reason to use something for performance reasons, I’ll bite. Otherwise, it seems silly. The prompts will not differ much and the rewrites are trivial. What matters to me is the experience, not the tech.
I completely agree. I stopped caring about programming languages now that AI writes all the code. And AI’s are really good at C++ so that’s my weapon of choice.
Given the price of RAM, I'd say it's nice to think about performance?
But there are more mature languages that are in the same performance class as Rust (e.g. C++, ObjC, Swift). Rust with an immature toolkit may be worse than WinUI + C++ or SwiftUI + Swift.
> e.g. C++, ObjC, Swift
All of these languages have their own drawbacks that Rust doesn't. C++ is a toolchain management nightmare, ObjC is antique, and Swift's core team was called "toxic" by Lattner himself.
Which is not to say that Rust is a perfect language (especially for GUIs) but it's no wonder we ended up in this situation. The 14 competing standards all drove themselves into a lake.
If you have multiple megabytes of RAM, the language you use for GUI-related activity is basically meaningless in terms of performance. Other factors dominate massively.
It is possible to write software that conserves memory in almost any language. It’s easier in some languages than others. But AI makes it so that the difference between languages matters less.
we've been circle jerking ever since win32 and vb6.