r/programming • u/SpecialBread_ • 2d ago
Rewriting an entire UI in Rust
https://gitcherrytree.com/blog/rewriting-the-ui-in-rust/6
u/daltorak 2d ago
You didn't cover memory usage, which should always be considered when switching to (or from) a web-based framework to something native. How are things looking on that front?
1
u/SpecialBread_ 2d ago
on memory usage its not too different, i guess its true i forgot to cover that, to me there was not a huge issue with memory though i did have to be careful with it on the react side of things.
With Iced memory usage is lower since I cache some stuff to load it faster the next time. and that is scaled with the repo size, where on a 300k file/40gb repo its a couple hundred mb in total. all that is on the backend though so the ui isnt affected.
the ui is generally memory light though commit and file diffs can get large. there rust is nicer, since js had about 5-10x overhead compared to the file size its viewing. that said, i had reduced that to 1.5x overhead so about 60mb for opening a 40mb file diff (i.e. 1m lines of text)
most files are much smaller than that or binary, so the memory pressure was not something i dealt with.
Since here i was moving from tauri to rust, and half of tauri is rust already i didnt have a huge footprint overall.
so: id say it wasnt a big deal, though with a rust ui i had to think about it less by default.
19
u/chucker23n 2d ago
I'm confused by this part. It sounds like they're trying to do their own UI framework. If you want DirectX-based, there's already WPF and WinUI.
Black bars on resize sounds like a classic issue double-buffering would solve, but you don't really need that in a modern compositing UI framework.