`tests/chain_cost.rs` times the pass on the GPU with timestamp queries, which this adapter supports, rather than by the clock. 200,000 two-pixel instances at 1024x1024, so vertex work dominates, best of eight batches: depth 1 77.9 us +0.0% depth 2 78.1 us +0.2% depth 4 79.0 us +1.3% depth 8 81.8 us +5.0% depth 16 111.1 us +42.6% depth 32 159.6 us +104.9% depth 64 250.3 us +221.3% Free to about depth 8 and then roughly 3 us per level. Each step is a storage load whose address is the previous load's result, so it is the chaining that costs rather than the arithmetic at each level -- which means the number would look the same for a slot carrying a whole region instead of a delta. That matters because every active widget owns a slot, so a primitive resolves through its full depth in the widget tree, and LAYOUT.md notes real trees have exceeded 16. At the couple of hundred primitives an example draws it is nothing; a transcript's glyphs are tens of thousands of primitives, which is the regime measured here. No behaviour change. Recorded rather than acted on: keeping the chain shallow means not giving every widget a slot, which is a design decision of LAYOUT.md §2 and §6 and the owner's to make.
iris
My experimental attempt at a rust ui library (also my first ui library).
It's currently designed around using retained data structures (widgets), rather than diffing generated trees from data like xilem or iced. This is an experiment and I'm not sure if it's a good idea or not.
Examples are in examples, eg. cargo run --example tabs.
Goals, in general order:
- does what I want it to (text, images, video, animations)
- very easy to use ignoring ergonomic ref counting
- reasonably fast / efficient (a lot faster than electron, save battery life, try to beat iced and xilem)
dev details
not targeting web rn cause wanna use actual nice gpu features & entire point of this is to make desktop apps / not need a web browser
general ideas trynna use rn / experiment with:
- retained mode
- specifically designed around wgpu so there's no translation
- postfix functions for most things to prevent unreadable indentation (going very well)
- events can be done directly where you draw the widgets
- almost no macros in user code & actual LSP typechecking (variadic generics if you can hear me please save us)
- relative anchor + absolute offset coord system (+ "rest" / leftover during widget layout)
- single threaded ui & pass context around to make non async usage straightforward (pretty unsure about this)
- widgets store outside of the actual rendering so they can be moved around and swapped easily (unsure about this but seems to work good for now)
under heavy initial development so not gonna try to explain status, maybe check TODO for that; sizable chance it gets a rewrite once I know everything I need and what seems to work best
it's called iris because it's the structure around what you actually want to display and colorful