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
wt list is faster and does that lazy thing where it updates on the fly - it outputs 4 items for example currently in my repo wt select outputs 100s (all branches and stuff?)
I can't paste the output from those 2 commands, because it's quite sensitive. But I passed it via Claude Code for what it's worth:
⏺ Now I have the full picture. Here's my analysis:
Summary: Why list is fast and select is slow
The Numbers
┌───────────────────────┬────────────────────┬──────────────────────────┬───────┐
│ Metric │ list │ select │ Ratio │
├───────────────────────┼────────────────────┼──────────────────────────┼───────┤
│ Output lines │ 293 │ 5,697 │ ~20x │
├───────────────────────┼────────────────────┼──────────────────────────┼───────┤
│ Branches processed │ 4 (worktrees only) │ 186 (all local branches) │ ~47x │
├───────────────────────┼────────────────────┼──────────────────────────┼───────┤
│ merge-tree operations │ 16 │ 376 │ ~24x │
├───────────────────────┼────────────────────┼──────────────────────────┼───────┤
│ Slowest operation │ 373ms │ 1,824ms │ ~5x │
└───────────────────────┴────────────────────┴──────────────────────────┴───────┘
Root Cause
list only operates on existing worktrees (4 in your case).
select runs git for-each-ref refs/heads/ to enumerate all 186 local branches, then computes detailed information for each branch:
1. git merge-tree --write-tree origin/master <branch> - 400-1800ms each
- Computes a hypothetical merge, requiring extensive object comparisons
2. git rev-list --left-right --count master...<commit> - 400-600ms each
- Counts commits divergence (some branches show 13,000+ commits behind!)
3. git diff --name-only origin/master...<branch> - 400-600ms each
- Lists changed files between branch and origin/master
4. git merge-base --is-ancestor - 100-500ms each
- Checks ancestry relationships
Why Some Operations Are Especially Slow
Looking at the output, branches like notify-companies-when-integration-connectedby-users-are-adv-111 show 13127↓ commits behind master. Old stale branches require traversing huge commit histories, making operations like rev-list and merge-tree extremely expensive.
(iirc, skim, the library that does the fuzzy-find-panel doesn't support later updating of items. but then we should probably render less / skip ops for some branches)
@KidkArolis we now pre-check if it's likely to be expensive, and then skip the expensive checks that need to walk the tree to get the merge-base. So the next version should be much faster; lmk how you get along.
(I haven't benchmarked the final version, but benchmarked early ones — so possible I made a mistake, would be helpful feedback if I did!)
Thanks! Yeah, it's better, it's now 3-4 seconds for me. Which is still too long to use daily, but tbh - at this point I'll also clean up my local branches 😅
Wondering though - why list all branches in wt select? why not just list worktrees - I only have 3 worktrees, I see them with wt list, I'd expect to see the same 3 with wt select and be able to switch easily. Maybe wt select --all could show all branches, similar to git branch -a.
ok, that's still way too long. I had a quick look and it looks like there aren't many easy wins; to some extent we just had to call a lot of git commands, even after cutting the most expensive ones.
re the branches — I think I agree with you. I originally found this useful as "what's available to work on", which included my branch list. but we could add a similar --branches flag that we currently have on wt list, and add a similar config / share it with wt list. I'll make this change.
Activity
max-sixty commentedon Jan 7, 2026
that sounds bad!
does
wt listsuffer too?max-sixty commentedon Jan 8, 2026
the new version
0.10.0we produce a diagnostic file withwt select -vv; would you mind pasting the output of that in here?KidkArolis commentedon Jan 8, 2026
wt listis faster and does that lazy thing where it updates on the fly - it outputs 4 items for example currently in my repowt selectoutputs 100s (all branches and stuff?)I can't paste the output from those 2 commands, because it's quite sensitive. But I passed it via Claude Code for what it's worth:
max-sixty commentedon Jan 8, 2026
the Claude Code output is perfect, thanks!
let me work on this...
(iirc,
skim, the library that does the fuzzy-find-panel doesn't support later updating of items. but then we should probably render less / skip ops for some branches)Refactor benchmarks to unified config system
feat(select): add 500ms timeout for git commands to improve TUI respo…
feat(select): add 500ms timeout for git commands to improve TUI respo…
Add benchmark for GH #461: branches at different history depths
Add benchmark for GH #461: branches at different history depths (#488)
perf(select): skip expensive tasks for stale branches
max-sixty commentedon Jan 10, 2026
@KidkArolis we now pre-check if it's likely to be expensive, and then skip the expensive checks that need to walk the tree to get the merge-base. So the next version should be much faster; lmk how you get along.
(I haven't benchmarked the final version, but benchmarked early ones — so possible I made a mistake, would be helpful feedback if I did!)
refactor(cache): use HashMap keyed by git_common_dir for test isolation
feat: add global merge-base cache for improved wt list performance (#508
perf(select): skip expensive tasks for stale branches (max-sixty#505)
KidkArolis commentedon Jan 11, 2026
Thanks! Yeah, it's better, it's now 3-4 seconds for me. Which is still too long to use daily, but tbh - at this point I'll also clean up my local branches 😅
Wondering though - why list all branches in wt select? why not just list worktrees - I only have 3 worktrees, I see them with
wt list, I'd expect to see the same 3 withwt selectand be able to switch easily. Maybewt select --allcould show all branches, similar togit branch -a.Add timeout_effect benchmark for GH #461 investigation
Add timeout_effect benchmark for GH #461 investigation (#534)
max-sixty commentedon Jan 11, 2026
ok, that's still way too long. I had a quick look and it looks like there aren't many easy wins; to some extent we just had to call a lot of git commands, even after cutting the most expensive ones.
re the branches — I think I agree with you. I originally found this useful as "what's available to work on", which included my branch list. but we could add a similar
--branchesflag that we currently have onwt list, and add a similar config / share it withwt list. I'll make this change.Add benchmark variants for GH #461 performance investigation
Add benchmark variants for GH #461 performance investigation (#539)
max-sixty commentedon Jan 12, 2026
this is now live —
wt selectinherits fromwt listin behavior/flags/defaults/configs.thanks @KidkArolis (and lmk if that doesn't help still!)
bench(list): consolidate synthetic `wt list` benches into one `full` …