Update the layout measurements to the current head

Three more roundings and divisions taken out after measuring each, one
optimisation tried and reverted with its number kept so it is not tried
again.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
iris-aiandClaude Opus 5 committed 2026-09-16 04:14:18 -04:00
1 parent 6081726314
commit f83be016ba
1 file changed
+20 -15
+20 -15
View File
@@ -8,7 +8,7 @@ log.
Canonical Iris `main` is **`ca2b4b2`** (#17, the headless rig). **#18
`split/18-position-chain`** is open in `/home/bob/repos/iris-pr18`; its local
head is **`f11f5f4`**, sixty commits. Built-in alignment is complete there;
head is **`4f5e27c`**, sixty-three commits. Built-in alignment is complete there;
see "Built-in alignment" below for the retained-layout details. No PR reviews
were present when checked on 2026-09-15.
@@ -72,7 +72,7 @@ rewrite:
`core/src/ui/holds.rs`, the retained tests, and the generated cold-layout oracle
pin those rules. Seeds 10 and 86 are now in the ordinary generated set.
## Verification at `f11f5f4`
## Verification at `4f5e27c`
- `cargo fmt --all --check`
- `cargo build --workspace --all-features`
@@ -124,12 +124,12 @@ Measured 2026-09-16 on the release `layout_diagnostics` fixture, seed 1,
depth 8, 500 frames, as median milliseconds a frame. `5ed9e87` is the commit
before fixed point; `39e4ca2` is fixed point complete.
| phase | `5ed9e87` | `39e4ca2` | `f11f5f4` |
| phase | `5ed9e87` | `39e4ca2` | `4f5e27c` |
| --- | ---: | ---: | ---: |
| many | 0.179 ms | 0.544 | 0.278 |
| resize | 0.020 | 0.035 | 0.041 |
| scroll | 0.011 | 0.030 | 0.020 |
| repaint | 0.012 | 0.031 | 0.028 |
| many | 0.179 ms | 0.544 | 0.274 |
| resize | 0.020 | 0.035 | 0.033 |
| scroll | 0.011 | 0.030 | 0.019 |
| repaint | 0.012 | 0.031 | 0.021 |
**Fixed point cost 3x, and two thirds of that was not the grid.** The
counters said eight more "placed by redrawing" a frame in `scroll`, all of
@@ -139,14 +139,19 @@ drawing it again on the child layer. `97cc8b3` measures on the layer the
child ends up on, which puts the scroll phase's counters back exactly where
they were -- 4 widget draws, 12 draw requests.
What is left is per-operation cost, not more work: at `f11f5f4` the `many`
phase does 125 widget draws against 121 before, and takes 1.6x as long. The
arithmetic is the difference -- an `i64` multiply and a rounding branch where
there was an `f32` multiply. The profile's shape, in order: `InstanceList::
push`, `Painter::glyphs`, `RegionRemap::apply_span`, `UiRegion::within`. The
one obvious thing left is `glyphs`, which converts four `f32`s per glyph:
a `GlyphEntry` holding `Px` would convert once when the glyph is rasterised
instead of on every frame that draws it.
What is left is per-operation cost, not more work: the `many` phase does 125
widget draws against 121 before, and takes 1.5x as long. The arithmetic is
the difference -- an `i64` multiply and a rounding branch where there was an
`f32` multiply, and an `i64` division in the remap. Three were taken out
after measuring (`11c55bc`, `4f5e27c`, and halving the divisions in
`Holds::through`); `RegionRemap::apply_span` is still a fifth of the phase,
and the rest is spread thin. Measure with `perf stat -e instructions:u`
rather than the clock, which varies 2x here.
One thing tried and reverted, recorded so it is not tried again: short-
circuiting `apply_scalar` where the fraction is nought or one. Those are not
the common cases, and the comparisons cost 17% more than the divisions they
saved.
Earlier, against #18's own history: the retained rewrite took `many` from
25.17M instructions a frame at `691e3eb` to 6.14M at `29c7881`, and `resize`