Commit 2ca2fe7
perf: optimize worktree lookup by combining awk processes
Modified `list_worktrees` to optionally accept a target branch name and
perform filtering internally. This eliminates redundant sub-processes
in `goto_worktree` and `remove_worktree` and allows for early exit
once a match is found.
Benchmark results (100 iterations of `goto_worktree`):
- Baseline: ~1.55s real, ~1.35s user
- Optimized: ~1.44s real, ~1.04s user
- Improvement: ~7% real time, ~23% user time reduction.
Co-authored-by: RodrigoEspinosa <1685621+RodrigoEspinosa@users.noreply.github.com>1 parent b252255 commit 2ca2fe7
1 file changed
+20
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
| 74 | + | |
74 | 75 | | |
75 | | - | |
76 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
77 | 92 | | |
78 | 93 | | |
79 | 94 | | |
| |||
138 | 153 | | |
139 | 154 | | |
140 | 155 | | |
141 | | - | |
| 156 | + | |
142 | 157 | | |
143 | 158 | | |
144 | 159 | | |
| |||
151 | 166 | | |
152 | 167 | | |
153 | 168 | | |
154 | | - | |
| 169 | + | |
155 | 170 | | |
156 | 171 | | |
157 | 172 | | |
| |||
0 commit comments