Record glyph emission savings and remaining layout costs

This commit is contained in:
iris-ai committed 2026-09-17 16:18:18 -04:00
1 parent 264dc4f0c2
commit 035c7f20e8
1 file changed
+47 -2
+47 -2
View File
@@ -423,7 +423,7 @@ The original proposal was implemented by Claude as `5fcace1` on
`wip/region-and-placement` in `/home/bob/repos/iris-pr18`. It kept the fraction
reference stable but failed five layout cases and three draw-count cases.
The first correction is `efb416b`, exact recomposition is `2ed5503`, and the
current performance/alignment continuation is **`7601aa2`**, pushed to origin's
current performance continuation is **`a7307d9`**, pushed to origin's
`wip/region-and-placement`, in the isolated checkout
`/home/bob/repos/iris-layout-experiment`; **it is not on PR #18**. The original
checkout is unchanged. Keep the experiment's build directory separate: Cargo
@@ -507,7 +507,7 @@ center. Do not describe those two centers as the same thing or compensate with
an arbitrary offset. The parked padding API change is still separate.
Ordinary verification passes: formatting, workspace clippy with
`layout-diagnostics`, workspace tests (100 suite tests and 21 core tests), and
`layout-diagnostics`, workspace tests (101 suite tests and 21 core tests), and
the fast generated cases. The corrected `tabs` resize from 1920x1200 to
900x1200 matches a cold image with zero differing pixels. The release oracle
passes 2000 seeds at depth 4 and 1000 at depth 6; the shrinker passes 400 at
@@ -557,6 +557,51 @@ with each range less than 1.3% of its median. Additional depth-6 fixtures,
7.0% for size and 8.4% for resize; seed 13 improves resize by 9.2%, while its
size samples overlap and establish no cycle improvement.
**Glyph emission now composes its origin once per text draw.** Glyph offsets
and bitmap sizes are pixel lengths, so composition adds them unchanged. The
fresh draw resolves the shared frame/extent origin once, then adds each glyph's
offset and size. Retained local geometry is unchanged; a regression compares
fresh drawing with retained recomposition for fractional origins, negative
pixel offsets, changing frames and extents, and region nodes. This adds no
retained state and changes no layout decisions.
Against `7601aa2`, nine alternating pairs of direct, uninstrumented release
executables under `perf stat -e cycles:u,instructions:u`, seed 1, depth 8,
2000 frames per process, including setup:
| phase | cycles before → after (billions) | instructions before → after (billions) |
| --- | ---: | ---: |
| size | 4.5164 → 4.0909 (-9.4%) | 12.1709 → 10.3993 (-14.6%) |
| resize | 5.3025 → 4.8044 (-9.4%) | 14.2150 → 12.1999 (-14.2%) |
| many | 5.2743 → 4.8071 (-8.9%) | 14.0989 → 12.0868 (-14.3%) |
All nine samples per side were retained; before/after cycle ranges do not
overlap. No scans or builds ran during measurement. All instrumented work
counters match `7601aa2` on all six phases (50 frames, cold once), including
the draw and primitive counts in the table above: this reduces the cost of
emitting the repeated glyphs, not the repeated layout evaluations themselves.
Additional depth-6 fixtures, nine alternating pairs and 4000 frames each:
seed 3's size updates improve cycles by 5.0% and instructions by 8.0%; seed
13's resizes improve cycles by 8.5% and instructions by 13.6%, both with
nonoverlapping cycle ranges. Seed 3's resize and seed 13's size ranges overlap.
On seed 1/depth 8, cold (one frame/process) and scroll (300,000 frames) also
have overlapping cycle ranges. Repaint (1,000,000 frames) measures 1.1% more
cycles, with nonoverlapping ranges and just 0.02% more instructions: this slice
has a small measured repaint cost alongside the text-heavy gains. All nine
samples per side were retained in these checks too.
The verification runs above pass again at this head. All five reference
renders (`view`, `minimal`,
`random`, `tabs`, `text`) match `7601aa2` pixel for pixel at 1920x1200; `tabs`
resized to 900x1200 matches a cold render there. The GPU probe reported Venus
on the RX 7900 XT in this session.
Two trials were removed: combining frame recomposition with extent movement
saved under 0.8% of instructions and no cycles; special-casing equal endpoint
fractions in `UiSpan::within` cost 11% cycles and 7% instructions despite still
inlining. Keep that hot general composition small.
**The remaining gap has not been established as an unavoidable correctness
cost.** A temporary failure trace of one frame on seed 1, depth 8 counted
39/108 failed reuse attempts in size, 65/151 in resize, and 45/109 in many