Unless that RwLock is in contention to get acquired every frame I doubt it will add anything significant to the frame time. Worrying about things like this without profiling can cause a lot of unnecessary complexity when planning abstractions in Rust.
Furthermore- UI updates are usually all run from the same single thread, so it’s unlikely the other widgets could even contend for that lock! You might be able to get away with the lock approach and you may even be able to use Rc<RefCell<_>>, which would get a little speed up.
I appreciated the explorations of the complexities of widget rendering, and syntax construction, and explorations of possible solutions and their tradeoffs, with ultimately a reasonable conclusion from the author that it wasn't worth their effort.
This was a great introduction to the design space of TUI libraries. Thanks!
> I think it's okay to both explore and to give up, other paths await.
100%, and thank you for taking us on this enlightening journey. Too much is lost to silent "failure"
Reminds me of Turbo Vision, a TUI toolkit from 1990's: https://en.m.wikipedia.org/wiki/Turbo_Vision
It did not have shader nodes, but it run very well on 10MHz computers with a single megabyte of RAM (or less).
Even armed with a library like charms or bubbletea in Golang, sometimes its just amazing how all the internals "clicked" together, to render layouts and widgets.
Problem is when we think UI frameworks we usually run in something that handles a lot of things for us: browser, xorg, wayland etc. You don't get in terminal, so a lot of times TUI frameworks result being a thin abstraction on top of a render-loop.
Then you can't slap something like MVC pattern on it because that isn't how terminal app works. The event handler pretty much has to be global, even if the framework provides some focus management capabilities.
I've tried using different languages and frameworks for thing that I'm working on and pretty much ready to comeback to ratatui.
Whoa a programming game. Interesting :D