aboutsummaryrefslogtreecommitdiffstats
path: root/src/expr.c
diff options
context:
space:
mode:
authoruser <user@clank>2026-08-14 22:05:59 +0200
committeruser <user@clank>2026-08-14 22:05:59 +0200
commitf655e7882ef60c5865fae84bd35d4d33ca52d5c2 (patch)
treeac8a449d814e269fe919ab44ef82892512e5e7f1 /src/expr.c
parentsl0ppty: a README for people, not for the person who wrote it (diff)
downloadslosh-f655e7882ef60c5865fae84bd35d4d33ca52d5c2.tar.gz
slosh-f655e7882ef60c5865fae84bd35d4d33ca52d5c2.tar.xz
slosh-f655e7882ef60c5865fae84bd35d4d33ca52d5c2.zip
sl0ppty: walk the row, not screen_at()
shade_apply() reached every cell through screen_at(x, y), which re-derives the row base and bounds-checks a coordinate the loop already guarantees -- once per cell, per shader, per frame. Clipping the rect to the screen once, up front, makes the pointer arithmetic provably in range, so the inner loop can walk a row. Same output, and the clip is not a behaviour change: the layout never asks for a rect that needs it, and a caller that did was getting NULL-skipped cells before. Measured with .scratch/shprof.c on a 200x50 pane and a three-pass chain: 8.0 -> 6.1 ns per cell-pass, 0.24 -> 0.18 ms per frame. That profile also says where the time is *not*: `vignette`, which computes squared distances and a divide, is cheaper than `dim`, which computes nothing. The arithmetic in these shaders is free; what costs is per-cell overhead and the colour mixing. Anyone arriving here to precompute a per-cell amount table should read the numbers first -- it buys nothing.
Diffstat (limited to 'src/expr.c')
0 files changed, 0 insertions, 0 deletions