Skip to content

perf: batch tmux lookups, parallelize git enrichment, streaming file copy - #9

Merged
htcarr3 merged 1 commit into
mainfrom
improvements-021426-3
Feb 15, 2026
Merged

perf: batch tmux lookups, parallelize git enrichment, streaming file copy#9
htcarr3 merged 1 commit into
mainfrom
improvements-021426-3

Conversation

@htcarr3

@htcarr3 htcarr3 commented Feb 15, 2026

Copy link
Copy Markdown
Contributor

What

Performance optimizations reducing subprocess calls and enabling parallel I/O across TUI, CLI, and MCP commands.

Why

With 10 workspaces, the TUI dashboard was spawning 60+ serial git subprocesses plus 10 serial tmux has-session calls. CLI list commands had the same per-workspace tmux overhead. File sync was reading entire files into memory unnecessarily.

How

  • Bulk tmux lookup: Replace per-workspace tmux.IsRunning() (N subprocesses) with a single ListFr8Sessions() call + map check in cmd/list.go, cmd/mcp_tools.go, and internal/tui/model.go
  • Parallel git enrichment: Fan out per-workspace git calls (DirtyStatus, LastCommit, IsMerged, AheadBehind, TrackingBranch) using goroutines in TUI loadWorkspacesCmd
  • Parallel global run: runAllGlobalCmd collects start jobs then fans out with semaphore-bounded (5) concurrent tmux.Start calls
  • filesync size check: filesEqual now compares os.Stat sizes before reading content — short-circuits on size mismatch
  • Streaming file copy: Replace os.ReadFile/os.WriteFile with os.Open + io.Copy to avoid loading entire files into memory
  • Slice pre-allocation: handleRepoList pre-allocates with known capacity

Test plan

  • go build ./...
  • go vet ./...
  • go test -race -count=1 ./...
  • bin/ci passes all checks (build, vet, test, lint, tidy)
  • New tests for filesEqual size check, copyFile streaming, mode preservation, overwrite, and missing source

…copy

- Replace per-workspace tmux.IsRunning() subprocess calls with a single
  ListFr8Sessions() bulk lookup + map check in list, MCP, and TUI commands
- Parallelize per-workspace git enrichment (DirtyStatus, LastCommit,
  IsMerged, AheadBehind, TrackingBranch) in TUI loadWorkspacesCmd
- Parallelize runAllGlobalCmd tmux starts with bounded concurrency (5)
- Add size check short-circuit to filesEqual before reading content
- Replace os.ReadFile/os.WriteFile with streaming io.Copy in filesync
- Pre-allocate slice in MCP handleRepoList
@htcarr3
htcarr3 merged commit 488fb91 into main Feb 15, 2026
6 checks passed
@htcarr3
htcarr3 deleted the improvements-021426-3 branch February 26, 2026 20:25
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