You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mecatui: shrink ui.Model so the reducer stops copying 66 KB per message #2411
ui.Model is 66,400 bytes and is passed by value through the Bubble Tea reducer chain (Update → update → afterEvent → dispatchNonInputMsg → onStreamMsg → updateStreamEvent → …). Each value-receiver frame copies it, so every message, keystroke, and stream delta copies 66 KB several times.
A keystroke frame benchmark spends ~0.6 ms and ~1.8 MB of allocation in the reducer alone.
The event goroutine's stack doubles to 4–8 MiB; most of it sits freed in the stack pool.
Proposal
Move the cold sub-states behind pointers (schedule, worktrees, overlay states, possibly prompt) so the Model falls under ~20 KB. This needs care wherever a reducer relies on value-copy semantics (copy-on-write or explicit clones there).
Acceptance
unsafe.Sizeof(ui.Model{}) stays under a guard test threshold.
The keystroke frame benchmark shows fewer bytes per op.
Activity