Hacker Newsnew | past | comments | ask | show | jobs | submit | raphlinus's commentslogin

This is most likely crank bullshit. Previous discussion here: https://news.ycombinator.com/item?id=50593195


Thanks.

The point I'm making is a subtle one. I do think you can go very far with an immediate mode GUI paradigm, and it's also certainly the case that most of the imguis you see are performant. But I still wouldn't choose it for a design or productivity app.

Once you do all the caching of text layouts and building of intermediate trees for a11y, you no longer have a pure imgui, but rather a hybrid.

I'm going to try to get this point across in an analogy, apologies to people not familiar with the referent.

Let's say you're frustrated with the size and complexity of a modern C compiler like clang or gcc, and want to do something simpler. One of the design decisions is whether use SSA (static single assignment) as the basis for the intermediate representation. If you're going for simplicity, you might quite reasonably choose to skip it; you can generate reasonably good code straight from the AST.

But then, you and your users get dissatisfied with merely reasonably good code, and want some of those optimizations that make production compilers generate actually fast code – constant folding, common subexpression elimination, strength reduction, etc. You can certainly implement them as AST transforms, but it gets difficult to track everything? You add a bunch of logic and eventually get those optimizations to work about as well as the SSA-based version in real compilers.

Another compiler designer has similar goals but uses a different strategy: dive in and do SSA from the beginning, which is not as simple at first, but then you can just do those optimizations "from the book," without a lot of friction.

Basically what I'm saying is that I prefer the second compiler. It's not to say the first can't be made to work.


I guess it depends what you define as an "imgui". To me, I think it's when the application describes the UI every frame. I don't think purity of approach is very relevant though. I'm happy to concede that a hybrid approach is better - in all things, balance :)

If I understand the point of the analogy, it's basically that when you bolt sophisticated optimizations onto a representation that wasn't designed for them, the bookkeeping accumulates in an ad hoc way, while a representation purpose built for those transforms makes the same optimisations feel like they fall out of the structure. Would that be valid?

If so I would actually swap imgui's and retained mode ui's around. In an imgui, you can implement domain-specific caching and other performance optimisations for your bottlenecks, whereas in retained mode UI you're building against a general system and you often need to resort to hacks to rescue performance, or design your data model in a way that is amenable to change detection. Memoization, keys and identity gymnastics, state sliced into atoms/signals/items, "this component only depends on X" annotations, Equatable conformances, Identifiable fake IDs, keeping structs small and pruned so the diff is cheap, splitting views so diff granularity lines up with actual change granularity, id resets to force identity, etc. Fixing performance in React is largely about reshaping your data model until it's legible to the framework's change detection. When you use fine-grained reactive systems you need to adopt the framework's data stores and it ends up infecting your entire application. You cannot just pull in a dependency and use it's state directly - you need to martial it into signals or stores or set up subscribers.

Whereas in an imgui it's trivial to benchmark and if you notice that a list is performing a lot of work on each update cycle you can apply an optimisation that is impossible in a more general system.

SSA isn't simply a retained representation of an AST. It's a representation with properties that make particular analyses and transformations easier. What specific properties of a retained mode UI representation make the important operations of a design application easier, and what is the cost of obtaining those properties? If the answer is stable widget identity, incremental invalidation, persistent layout relationships, and accessibility object lifetimes, thats fine, but an immediate-mode system can introduce those capabilities selectively, without necessarily adopting the entire retained-mode programming model.

In other words, the question isn't whether you need the equivalent of SSA, it's if you need to make SSA the foundation of your entire application.

Fwiw I'm building a desktop application with Egui and Bevy and it's been a breath of fresh air compared to building applications with classical retained-mode systems. An entire class of bugs and complexity regarding state management just goes away. Performance is ~3ms including the entire render pass (more than just UI), and all of the complex components that required caching and other performance optimisations would have had to be hand-rolled in a retained-mode system anyways - except with Egui those optimisations are simple to build. All of the state just lives in Bevy's ECS without any real considerations for the UI, because the UI systems can just reach into the world and read it directly. Some parts of the UI live as entities with relationships forming a tree, so you might say that's approaching a retained-mode system, but it's implemented selectively where it's useful - most of the UI is transient.

But to each their own - some people seem to "click" more with a retained mode approach and it's still a valid choice to use it if you prefer it.


Please consider other performance metrics like battery life. One of the new experiences for me as a developer this year was finding that platform-provided profiler can show me milliwatts spent alongside the milliseconds.

Yep, generally you only draw new frames on input or if there is an active animation. But even in the most unoptimised case there isn't a massive difference

   Immediate
     Dear ImGui  7.5
     ImPlot      8.9
     EGUI        8.2
     Rerun       11.1

   Retained
     Spotify     5.8
     VSCode      7.0
     YouTube     11.5
     Facebook    8.7
https://www.forrestthewoods.com/blog/proving-immediate-mode-...

Did you also measure the actual refresh rates? I think the browser engines will reduce refresh rate in certain cases and not run at the full Hz of the display. This might influence the numbers a lot.

> First, it must be noted that the IMGUI tests are running at a full 120 Hz with zero idle optimizations. This is to simulate a "worst case scenario" of a rich and dynamic GUI. Meanwhile the RMGUI tests are running with idle optimizations.

You're thinking about it from the perspective of an individual. And I've had a similar experience. But take a closer look what it does to systems, processes, and communities.

I'm thinking about it in the context of an organization. And those few smart people who give a shit, their ability to make massive changes. As someone said elsewhere in this thread in an organization of hundreds, sometimes only a handful of people give a shit. I don't think it's a bad thing at all if those people are empowered.

A retrocomputing Stack Exchange [1] thread looks like a really good source. That in turn cites [2] with Stephen P Morse, 8086 architect, as first author. I'd consider that pretty authoritative.

The exact quote from the latter source is:

"Several other instructions that had been contemplated were not made available because of the software ramifications and the compatibility constraints they would place on the forthcoming 8086."

[1]: https://retrocomputing.stackexchange.com/questions/8040/whic...

[2]: Intel Microprocessors: 8008-8086 published in IEEE Computer, Vol 13, No. 10, page 46, October 1980


Awesome. Thanks.

What, no elliptic integrals?

It turns out the math for the pendulum is the same as the math for the elastica. I go into this in some depth in my history of the elastica [1].

[1]: https://www2.eecs.berkeley.edu/Pubs/TechRpts/2008/Archive/EE...


That report on Elastica is one of my favorite documents on the internet. I have read it a number of times but it had never occurred to me that it is authored by you.

BTW elliptic integrals come up in modeling bending of bows too.

https://www.bio.vu.nl/thb/users/kooi/kosp80.pdf

More at https://www.bio.vu.nl/thb/users/kooi/

Oh hang on a second, this is essentially Elastica in a thin disguise, makes complete sense.

As I know you know, the other famous curve associated with Euler is of course the Euler Spiral aka Cornu Spiral aka Clothoid where a different interesting integral show up -- the Fresnel integral.

Where these two integrals come together are on uniform speed spirals on the surface of a sphere and its flattening.

Investigated by the famous Erdos himself and published four years after his passing.

https://pubs.aip.org/aapt/ajp/article/68/10/888/1055391/Spir...

As far as large angle deflection pendulums go Huygens cycloid enveloped pendulum too deserves a mention.

https://en.wikipedia.org/wiki/Cycloid#Cycloidal_pendulum


I think a rounded rectangle is defined as 4 straight line segments joined with G1 continuity to quarter circle arcs. I'm unaware of any other definition. The only variation I know is whether the radii have to be the same or can be different. Flexible implementations do allow the latter.

So a letter "D" is an extreme rounded rectangle with different radii on the left and right side? That makes some sense.

Yes, it's all software, and FM synthesis is using the same engine as dexed. It's a Blackfin chip, which has pretty good throughput for DSP (digital signal processing). A ton more detail is at [1], including the operating system, which is a FreeRTOS-derived SMP kernel.

[1]: https://github.com/AL-255/FM-1-RE


I get your point but disagree strongly. One topic that's been on my mind a lot is durability. The culture of LLMs is that everything is transitory. Why bother keeping a vibe coded codebase around for more than a few weeks, when the next big model iteration will be able to vibe code it better?

By contrast, free software in general, and Rust very much in particular, has cultural norms that things should last a while, rather than immediately being thrown away. I think that's worth preserving.


If you can run compute shader code, the fingerprinting and side channel possibilities become very rich. [1] is one paper among many on this topic.

[1]: https://dl.acm.org/doi/10.1145/3634737.3656283


Yes, and? As the cost of code generation approaches zero, this starts to make more sense, especially if you do have mechanisms in place to ensure safety and correctness.

I did an experiment a couple weeks ago of having Opus 5.5 translate an MP3 decoder from Rust into Cortex-M33 assembly language, both raw asm and symbolasm. The code was 3x smaller and ~1.5x faster than Rust -O3. These seem like gains that are worth it.


As the cost of code gen approaches 0 the cost of the test suite actually grows. Not just in definition, but execution.

An MP3 decoder for a single target doesn't really run into that complexity, a UI components library for (Linux, Windows, macOS) * (x86-64, ARM64) suddenly has a 6x multiplier on what was already something with waaay deeper dependencies and integrations than MP3.

At least that's what I've noticed vibing my DE without external libraries. It went really fast when the complexity was small because most of the work was in adding code. Then it started taking longer to build and test, even with optimized builds and tests, than it took for the AI to do its part.


Yes that makes sense, but if you're iterating on software then I think C will generally win due to its ability to compile cross-platform until you want to build a "release" which you could do by having Fable translate it to ASM at that point.

Did you have it go directly to asm or emit the assembly from the Rust toolchain and then contract that? For small stuff, I have been having it write directly, or larger pieces I am having better results via contractions.

For this experiment I had it write directly.

I should add, part of the experiment was to test whether having variable names and (C style) types would help the LLM. For a task of this size (about 1.5 kLoC Rust, 3k insn asm) it was inconclusive, but for larger projects I suspect it would make a difference.

And the plan for symbolasm is to move past C style types into Rust style and maybe dependent typing, specifically to facilitate automated proofs.


at that point, how hard would it be to get the LLM to just make the binary? (iow, llm as compiler)

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: