News for hackers. Stuff that matters.
Re:Advice for the next 100 Rust GUIs by codedokode on Sunday November 22, 2026 @11:08AM (#50600910)
> there are generally only a few dozen rectangles

Only in a hello world application. Every professional editor like GIMP has tons of tiny widgets. And redrawing one tiny widget on mouse over is faster than running the render function.

Also, you are assuming that running render function costs nothing while in real-world apps there will be array iteration (for example, to display a sum and average of values from a 100K element array), calling helper functions, generating SVG for a 10K points graph, etc.

Yes, writing good code is harder than bad code, especially for a LLM.

Re:Advice for the next 100 Rust GUIs by kragen on Sunday November 22, 2026 @11:34AM (#50601143)
You say I'm talking about a hello-world application, but I'm talking about Firefox, Emacs, and my window manager. Firefox has 10 tabs visible, 21 icons in the toolbar, five bookmarks, and about 20 HTML elements. This still adds up to a few dozen rectangles, not thousands or even hundreds.

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.

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.

Re:Advice for the next 100 Rust GUIs by kragen on Sunday November 22, 2026 @11:41AM (#50601228)
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.