Skip to content

Whole-pixel cells, a limit on unread output, and fewer scrollback scans - #18

Merged
sn merged 3 commits into
mainfrom
perf/cells-and-queue
Nov 19, 2026
Merged

sn merged 3 commits into
mainfrom
perf/cells-and-queue

Conversation

@sn

@sn sn commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

Three follow-ups to #17, one commit each.

A connection that stops reading is cut off. Replies and events for a connection waited in a queue with no limit, so a plugin or socket client that subscribed to events and never read them grew Lumen's memory for as long as it ran. With 16 MB waiting, nothing more is queued: a plugin is killed, which its log says, and started again like any that exited; a socket client is disconnected. Both are in the docs.

Prompts aren't looked for while the scrollbar is hidden. #17 left one case reading all the scrollback every 200 ms during output: scrollback full, with prompts in it. Where those prompts are only shows as marks on the scrollbar, so it's skipped while the scrollbar is hidden and done when it appears, including under the pointer.

Cells are a whole number of screen pixels wide. The font asks for 8.4 pixels at the default size, so columns alternated between 8 and 9 and each glyph was drawn at a different offset from the pixel grid. The width is now rounded: 8 at 1×, 13 at 1.5×, 17 at 2×. Every column is the same and every glyph is drawn the same way.

  • At 1× text is about 5% tighter, with as many more columns. This is the visible change.
  • Glyphs shaped together (ligatures, combining marks) are fitted to the cells they cover.
  • Shells are started before there's a window, so the scale is guessed for their first size: 1 on Linux unless GPUI_X11_SCALE_FACTOR says otherwise, 2 on macOS. A wrong guess costs one resize at launch.
  • The README's screenshots are from before this and haven't been retaken.

Checked on a real display (NVIDIA, X11, 120 Hz) as well as under Xvfb, at 1×, 1.5× and 2×: even columns, even box lines and rows, no gap at powerline arrows. 1.3.3 at 2× shows the gap and the uneven columns.

Time from writing to the pty until the window's pixels change, on that display, 200 samples twice over: 0.69 and 0.74 ms median on 1.3.3, 0.76 and 0.83 ms with this. The difference is within the noise. It doesn't include the compositor or the monitor.

Not checked on Wayland or macOS.

sn added 3 commits November 19, 2026 19:26
Replies and events for a connection waited in a queue with no limit, so a plugin or socket client that subscribed to events and never read them grew Lumen's memory for as long as it ran. With 16 MB waiting, nothing more is queued: a plugin is killed, which its log says, and started again like any that exited; a socket client is disconnected.
Once the scrollback is full its prompts move up as old lines go, and they were looked for again every 200 ms while output arrived. Where they are only shows as marks on the scrollbar, so that's skipped while it's hidden. It looks again when it appears, including under the pointer.
The font asks for cells a fraction of a pixel wide (8.4 at the default size), so columns alternated between 8 and 9 pixels and each glyph was drawn at a different offset from the pixel grid. The width is now rounded to whole screen pixels: 8 at 1x, 13 at 1.5x, 17 at 2x. Every column is the same and every glyph is drawn the same way. At 1x text is about 5% tighter, with as many more columns.

Glyphs shaped together (ligatures, combining marks) are fitted to the cells they cover. Shells are started before there's a window, so the scale is guessed for their first size: 1 on Linux unless GPUI_X11_SCALE_FACTOR says otherwise, 2 on macOS.
@sn
sn merged commit 271df66 into main Nov 19, 2026
2 of 4 checks passed
@sn
sn deleted the perf/cells-and-queue branch November 19, 2026 17:51
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