Once T9374 is fixed, this check is the largest remaining part of parsing a large list: at 10,000 rules it still adds about 40 s to each commit, and it grows faster than the list.
Root cause. find_duplicate_children (src/vyos1x_parser.mly) sorts the remaining list on every recursion step, although it is already sorted after the first: O(n² log n).
Numbers (T9374 fix installed in both columns):
| without this fix | with it | |
|---|---|---|
| one parse, 10,000-rule list | 5.14 s | 0.048 s |
| one parse, 32,000-rule list | 73.7 s | 0.148 s |
| three commits, 10,000-rule list (same node) | 297 / 300 / 282 s | 257 / 259 / 246 s |
Fix direction. Sort once and compare neighbours. It reports the same duplicate as before (the smallest duplicated name in sort order).