Re:Advice for the next 100 Rust GUIs
by codedokode on Sunday November 22, 2026 @11:37AM
(#50601176)
> the error-prone cache-invalidation logic
Because writing good code is harder than bad code.
Generally speaking, what distinguishes good code from bad code is that it minimizes the number of error-prone things that must be done. As Frank Borman said, "A superior pilot uses his superior judgment to avoid situations which require the use of his superior skill."
Re:Advice for the next 100 Rust GUIs
by codedokode on Sunday November 22, 2026 @12:15PM
(#50601641)
I agree we need to minimize programming errors - by designing a good reactive retained mode framework.
You say I'm assuming that the render function costs nothing. I thought it was clear that I was not assuming that; what I said in the comment that you're responding to is, "The amount of per-drawable work has to be almost three orders of magnitude larger before the per-pixel work isn't the dominant factor." But you may have responded before I added that; I forget if I added it in later. Here by "drawable" I mean talking about things like letters, not widgets that have their own render functions. Widgets that have their own render functions can take more than four orders of magnitude more time than the per-pixel work before the per-widget work becomes the dominant factor.
It's true, as you say, that people are capable of using up that margin by doing things like reading from a file, because writing good code is harder than writing bad code. But that's not really a question of immediate-mode vs. retained-mode. You can write bad code with retained-mode GUI libraries, too. In fact, my experience is that it's much harder to write good code with retained-mode GUI libraries.
As for layout calculations, the layout engine I elicited from Opus 5.5 for http://canonical.org/~kragen/sw/megilloom-sandbox lays out 60,000 lines of text per second, in JavaScript, and it supports table layout. (It caches the layout calculations so that it can remain responsive up to hundreds of thousands of lines.)
Some IMGUI libraries are capable of providing a dirty flag and damage rectangles without requiring every application to duplicate the error-prone cache-invalidation logic to do that. As Raph points out in this post, they're not a panacea. But they're not as bad as you are naïvely assuming them to be.