Every widget that reads its box in pixels was making `Moves` compose its slot's chain again, a mean of 2.8 levels, about eight hundred times a frame. A draw already descends past every one of those entries on its way in, so `DrawInfo` carries what the slot composes to and `draw_at` steps it one box further -- which is a select where it was a walk. `Moves::size_of` and `compose` are left for `redraw`, which starts mid-tree with nothing above it in flight. Measured on the fixed-shape fixture, seed 1 depth 8, 500 frames of `many`, medians of 25 runs, twenty-five work counters identical throughout: | | instructions | cycles | | --- | ---: | ---: | | `d21a215`, before exact composition | 1,908M | 760M | | `45a7176`, composing on the fine grid | 1,880M | 755M | | this | **1,840M** | **735M** | So exact composition ends up 3.6% fewer instructions and 3.3% fewer cycles than the rounding-per-level walk it replaced, and the widening it needed was paid for twice over by not doing the walk. `Holds::through`'s allowance does not move: two half steps is where shrinker seed 220 pins it, not where the arithmetic does. `Painter` still composes a child's region into its own on the grid before asking for it in pixels, which is the last narrow step in that path; taking it out needs the child's region as its parent stated it, which `draw_inner` is not handed. Checked: fmt, clippy, 83 suite tests, 17 core unit tests, the release oracle at 100 seeds and at 1000 seeds of depth 6, all fifteen shrinker cases at 400 seeds of depth 5, and `tabs`, `view`, `minimal`, `text`, `random` and the tab replay byte-identical at 1920x1200 against `45a7176`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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