summaryrefslogtreecommitdiff
path: root/src/memory.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-24 15:25:35 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:14 -0300
commita8931b8a3eed07af56edc10b21bcdd8f1e58a84a (patch)
tree8a1c97c375952ecb219cf86b352110115c876d27 /src/memory.zig
parentd395739c8051e28726a4111eec1111a9c70567ec (diff)
downloadpardes-a8931b8a3eed07af56edc10b21bcdd8f1e58a84a.tar.gz
pardes-a8931b8a3eed07af56edc10b21bcdd8f1e58a84a.zip
Find the grid cells under layers once a frame, not by scanning every layer for each cell
renderFrame skips the grid cells a body or tag layer paints itself, and it asked which those are cell by cell: for every cell, twice a frame (counting instances, then emitting them), bodyLayerAt and tagLayerIn walked all 16 body layers and all 119 tag layers. In a ReleaseFast profile of a full screen of src/pardes.zig those walks were about a third of the gui's CPU samples. coverLayers now fills each live layer's rectangle into a per-cell map once a frame, and the loops read one byte. The loops only ever asked whether some layer covers a cell, never which, so overlap order does not enter into it; the map marks exactly the cells the walks found: a tag layer only its viewport's first row, and a viewport past the grid only the grid's part of it. The loops over the layers a panel transition leaves get a second map, built only while one runs. A test holds the map to the old walk over a core's layouts (columns, stacked and collapsed panes, column tags, Tagbottom, message and leader chips) and 3000 random layer sets, some past the grid's edges or at the top of u16. Hidden captures of 27 layouts (message and prompt chips, a column grip rail, a PDF, an image, font and tagline changes), with and without leftover edge pixels, are byte-identical to before. Over 10 interleaved rounds (160x50 cells), renderFrame's CPU a frame falls from about 2.0 ms to 0.32-0.37 ms idle, scrolling, typing, under terminal spew and over a PDF (-82 to -84%, every round), and cell emission from about 1.07 ms to 0.27 ms. The first frame's CPU goes from 6.2 to 4.6 ms. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Diffstat (limited to 'src/memory.zig')
0 files changed, 0 insertions, 0 deletions