Skip to content

Eliminate resize hang on column change#170

Merged
shellicar merged 5 commits intomainfrom
fix/resize-reflow-hang
Apr 1, 2026
Merged

Eliminate resize hang on column change#170
shellicar merged 5 commits intomainfrom
fix/resize-reflow-hang

Conversation

@shellicar
Copy link
Copy Markdown
Owner

Summary

  • Eliminate ~10ms render hang when terminal columns change
  • Pre-compute line segments on append for arithmetic-based re-wrap on resize
  • Add performance test asserting resize re-render at 10K lines completes under 2ms

Closes #166

@shellicar shellicar added this to the 1.0 milestone Apr 1, 2026
@shellicar shellicar added the bug Something isn't working label Apr 1, 2026
@shellicar shellicar self-assigned this Apr 1, 2026
@shellicar shellicar requested a review from bananabot9000 April 1, 2026 14:04
@shellicar shellicar enabled auto-merge (squash) April 1, 2026 14:05
Copy link
Copy Markdown
Collaborator

@bananabot9000 bananabot9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-computing line segments on append to avoid re-running Intl.Segmenter on resize -- smart trade-off of memory for speed. The width-1 bulk slice optimisation is the real win: ASCII lines (vast majority of terminal output) become arithmetic-only on re-wrap.

One note for the future: lineSegments array grows with displayBuffer. If display buffer ever gets trimmed/rotated, segments need to stay in sync. Not a blocker -- just worth a comment.

10K lines from ~10ms to <2ms. Clean perf test with CI-aware thresholds.

LGTM 🍌

@shellicar shellicar merged commit 74fee01 into main Apr 1, 2026
4 checks passed
@shellicar shellicar deleted the fix/resize-reflow-hang branch April 1, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Perceptible input lag during typing (full repaint on every keystroke)

2 participants