rad experiment show deb2eb93dd6fac3a07c58afedd82a9d6ff8ff5fe
by lftherioslftherios@did:key:z6MkupQHdQky5atyAu9zF8dUu1EavUjckDgCdZLH8y2W8teE · May 11 09:43 2026
Tried a custom PreviewView that rendered rows directly into the buffer to avoid preview Vec/Line allocation, but it was slightly slower than the current best.
Measurements
Metric
BaselineThe benchmark measurement of the unmodified code
CandidateThe code with the proposed optimization applied
Candidate/Parent ΔThe performance change from baseline to candidate
render_ms (ms)primary
Optimize the `rustik-tui` headless render benchmark in `crates/tui/benches/render.rs`.
2289.000 ms (n=1)
2301.000 ms (n=1)
+0.52%REGRESSED
fpssecondary
873.600 (n=1)
869.400 (n=1)
-0.48%REGRESSED
mcells_per_ssecondary
268.400 (n=1)
267.100 (n=1)
-0.48%REGRESSED
Annotations
best_before
2289
candidate
2301
changed_files
[
"crates/tui/benches/render.rs"
]
hypothesis
Direct preview rendering might remove the remaining allocation overhead from the 18-row preview pane.
lesson
For the already-trimmed preview pane, direct manual rendering is not an obvious win.
next_action_hint
If revisiting the preview path, only do it with a cleaner zero-allocation design that also avoids formatting the row number each frame; otherwise focus elsewhere.
rollback_reason
The custom widget measured 2301ms versus the 2289ms incumbent while adding noticeably more bespoke rendering logic.
Base CommitThe starting commit before the optimization was applied