Skip to content

Emit one write per box middle row instead of three#7

Merged
alganet merged 1 commit into
mainfrom
perf-box
Jun 13, 2026
Merged

Emit one write per box middle row instead of three#7
alganet merged 1 commit into
mainfrom
perf-box

Conversation

@alganet

@alganet alganet commented Jun 13, 2026

Copy link
Copy Markdown
Owner

_tuish_draw_box_impl wrote the left border, fill, and right border as three separate _tuish_write calls inside the per-row loop, even though all three are loop-invariant. Build the row body once before the loop and emit a single write per row.

Output is byte-identical (verified by diffing the rendered buffer across full/partial borders, heavy/double/rounded styles, colors, degenerate sizes, and off-screen clipping). About 20% faster on a box-heavy workload (2000x 10-row boxes: 3.21s -> 2.57s under bash). Unit suites pass on bash/zsh/ksh93/mksh/busybox; the boxes integration test passes 22/22 against the existing .screen fixtures.

_tuish_draw_box_impl wrote the left border, fill, and right border as
three separate _tuish_write calls inside the per-row loop, even though
all three are loop-invariant. Build the row body once before the loop
and emit a single write per row.

Output is byte-identical (verified by diffing the rendered buffer across
full/partial borders, heavy/double/rounded styles, colors, degenerate
sizes, and off-screen clipping). About 20% faster on a box-heavy
workload (2000x 10-row boxes: 3.21s -> 2.57s under bash). Unit suites
pass on bash/zsh/ksh93/mksh/busybox; the boxes integration test passes
22/22 against the existing .screen fixtures.
@alganet
alganet merged commit 27a8cab into main Jun 13, 2026
28 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant