News for hackers. Stuff that matters.
Re:Advice for the next 100 Rust GUIs by __benny__ on Sunday November 22, 2026 @01:46AM (#50596926)
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.

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.

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.

Re:Advice for the next 100 Rust GUIs by SleepyMyroslav on Sunday November 22, 2026 @03:22AM (#50597437)
Please consider other performance metrics like battery life. One of the new experiences for me as a developer this year was finding that platform-provided profiler can show me milliwatts spent alongside the milliseconds.
Re:Advice for the next 100 Rust GUIs by __benny__ on Sunday November 22, 2026 @05:51AM (#50598382)
Yep, generally you only draw new frames on input or if there is an active animation. But even in the most unoptimised case there isn't a massive difference

   Immediate
     Dear ImGui  7.5
     ImPlot      8.9
     EGUI        8.2
     Rerun       11.1

   Retained
     Spotify     5.8
     VSCode      7.0
     YouTube     11.5
     Facebook    8.7
https://www.forrestthewoods.com/blog/proving-immediate-mode-...
Re:Advice for the next 100 Rust GUIs by bflesch on Sunday November 22, 2026 @06:04AM (#50598473)
Did you also measure the actual refresh rates? I think the browser engines will reduce refresh rate in certain cases and not run at the full Hz of the display. This might influence the numbers a lot.
Re:Advice for the next 100 Rust GUIs by __benny__ on Sunday November 22, 2026 @06:25AM (#50598609)
> First, it must be noted that the IMGUI tests are running at a full 120 Hz with zero idle optimizations. This is to simulate a "worst case scenario" of a rich and dynamic GUI. Meanwhile the RMGUI tests are running with idle optimizations.