Repository navigation
Conversation
… call
A board listing forked `tmux list-panes -t gi_<id> -F #{pane_current_path}`
for every running row, on top of the `list-panes -a` that proved the rows
alive. The charters extension lists the whole board on every poll pass, so
that was one fork per running session every two seconds. The liveness scan
now reads pane_current_path alongside the pid and the listing uses it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s scan Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 tasks done
The board's poll pass scans every pane every two seconds and never shows a directory, but the scan had started reading each pane's current path and prefixing every line with a fresh mark for it. At 70 panes that cost 39% more bytes and 8% more allocations per scan. ScanPanes is back to the liveness-only listing; ScanPanesWithPaths carries the directories, and only the session listing uses it, so it keeps its one tmux call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
A board with extensions installed spends most of a CPU core forking
tmux. In a 60 sexecsnoopof a live board with 149 sessions, the board process forked about 4,450 processes a minute. 2,073 of them weretmux list-panes -t gi_<id> -F #{pane_current_path}, and the board's tmux server sat at about 36% of a core answering them.Summary
poll_interval) goes throughBoardList. For each running row,sessionInfoforked onelist-panesto read the pane's directory. That came on top of thelist-panes -athe listing had already run to see which rows are alive. With about 70 running sessions, that is 70 forks per pass, or 30 passes × 70 ≈ 2,100 forks a minute, which is the 2,073 measured.#{pane_current_path}next to the pid (PaneScan.Paths), and the listing takes each running row's directory from it. Adopted panes, and a pane with no directory, still go throughPaneCurrentPathas before.Numbers
TestBoardListReadsEveryDirectoryInOneTmuxCallcounts thetmuxprocesses oneBoardListforks, through a logging shim, with 7 running sessions:On the board measured above, that removes the 2,073/min
list-panes -t … pane_current_pathline, about 47% of every fork the board made. Liveexecsnoopfigures after deploy will be added in a comment.Test plan
TestBoardListReadsEveryDirectoryInOneTmuxCall: fails onmainwith 8 forks, passes here with 1; also checks that a pane whichcd'd reports its new directoryTestPaneScanIgnoresALineBreakInADirectory: a forged line after a line break neither adds a session nor overrides a pid, and a trailing space in a path is keptgo test -count=1 ./internal/tmux/ ./internal/sessioncmd/ ./internal/extensionhost/pass, run withenv -u TMUX -u TMUX_PANEand a scratchTMUX_TMPDIRgo test -short ./internal/ui/: passes exceptTestFocusedAdoptedPaneEchoesQuicklyWithNoClientOfItsOwn(257 ms against a 250 ms wall-clock budget, with two other suites running in parallel), which passes 3/3 run on its own🤖 Generated with Claude Code