Commit 4e7a9cb
committed
perf: use Set for O(1) merge commit lookup instead of O(N*M) iteration
- Pre-build Set of PR commit descriptions before filter loop
- Change from commits.some() [O(M)] to Set.has() [O(1)] lookup
- Reduces complexity from O(N*M) to O(N+M)
Performance improvement:
- 50 direct commits × 100 total = 5,000 ops → 150 ops (96.7% faster)
- 100 direct commits × 500 total = 50,000 ops → 600 ops (98.8% faster)
Addresses Copilot performance feedback on hasCorrespondingMergeCommit check1 parent cac8ef8 commit 4e7a9cb
1 file changed
+11
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
214 | 222 | | |
215 | 223 | | |
216 | 224 | | |
| |||
224 | 232 | | |
225 | 233 | | |
226 | 234 | | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
| 235 | + | |
| 236 | + | |
233 | 237 | | |
234 | 238 | | |
235 | 239 | | |
236 | 240 | | |
237 | 241 | | |
238 | 242 | | |
239 | | - | |
| 243 | + | |
240 | 244 | | |
241 | 245 | | |
242 | 246 | | |
| |||
0 commit comments