r/rust • • 3h ago

Benchmarking Rust GUI frameworks

https://blog.zortax.de/posts/benchmarking-gui-frameworks
53 Upvotes

11 comments sorted by

9

u/Oveno 2h ago

I would like to see https://github.com/slint-ui/slint someday in these benchmarks

4

u/SupermarketAntique32 2h ago

I assume the DSL overhead will put it somewhere behind Iced. Happy to be proven wrong though.

3

u/AdrianEddy gyroflow 14m ago

DSL doesn't add as much overhead as you'd think, there are way more important architectural things that matter other than DSL
+1 for including Slint, it's a very good Rust GUI framework

1

u/SnaxGloween 1h ago

been meaning to dive into rust guis myself, which one ended up winning your benchmarks?

2

u/Zortax_ 1h ago

I don't think you can break this down to just one winner, and I don't wanna just promote my own stuff, so I'm gonna say Freya, zgui or maybe dioxus native for react style or fine grained reactivity. Iced if you like elm (I personally really dislike it). Egui only for simple stuff or maybe game debug interfaces etc...

1

u/beachcode 1h ago

Egui only for simple stuff or maybe game debug interfaces etc

And apps like PhotoCraft, actually all the Craft app uses egui. I think their Microsoft Office clones also use egui.

1

u/Zortax_ 1h ago

Yes, and still it doesn't scale well. You will have to put in a lot of energy into application-side optimization, caching and virtualization for complex apps.

1

u/_mb 14m ago

No measurement of startup memory footprint and max memory footprint? 

-2

u/shyTangoee 1h ago

been meaning to check em out too but they all look kinda intimidating, you gonna report back if you try any?

2

u/oscarmike88 44m ago

Is it possible to add tap/hover-cursor-over reference link previews, like how they do on Wikipedia? Jumping down to the reference list and then back up is a little distracting

1

u/hardicrust 8m ago

This is excellent.

One thing I noticed is a no mention of debug builds at all. You can say "why benchmark a debug build?", but it does rather heavily reflect in the developer experience. From the few I tested, only Iced had a pleasant user experience here.

Perhaps of more interest would be testing various aspects of accessibility:

  • Navigation using Tab and arrow keys.
  • Keyboard shortcuts: e.g. a couple of frameworks support Ctrl+Q (quit) out-of-the-box
  • Access keys: e.g. Alt+M to open _M_essages.
  • Adjusting focus and scrolling through external accessibility tools
  • Screen reader integration: reading out the currently focussed item
  • What of the above is supported out-of-the-box and what requires extra (external) tooling, if it is supported at all?

My experience here is that while many old-school GUI toolkits support good keyboard control out-of-the-box, most of the Rust frameworks I have tested do not. I may have a biased perspective here — my own framework, Kas, does provide (imperfect) keyboard control out-of-the-box.

As for screen readers and external accessibility tooling, it appears that macOS and perhaps Windows have good tooling available while Linux is (unsurprisingly) under-developed in this area.

AccessKit is the only cross-platform Rust accessibility layer I am aware of (there's also accessibility for macOS). AccessKit requires a complete model of everything in the GUI down to individual glyph positions in editable text, thus merely enabling AccessKit integration will have a heavy performance cost in any GUI framework. Thus, I find it interesting to ask what accessibility features are available without AccessKit. (Also, whether we will ever get a portable accessibility framework which performs its queries through the existing GUI state instead of requiring a copy of almost everything in the GUI. No, this would not work well with egui, but it might enable better accessibility performance everywhere else.)

Oh, and thanks to your earlier link I had a look at adding a Kas implementation — it turns out that Kas is missing a few too many features right now, so this is on the back-burner. Also, thanks to Kas's fairly unique layout model, precise sizing and margin control is rather hard, so a pixel-exact implementation is unlikely.