Repository navigation
Whole-pixel cells, a limit on unread output, and fewer scrollback scans - #18
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
GPUI_X11_SCALE_FACTORsays otherwise, 2 on macOS. A wrong guess costs one resize at launch.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.