Semantic Diff

#9260 Find duplicate pattern variables in a set of the bound names

1 commit

bf35764db1628906bf68c424735c68da4d1711fb..pr-9260

4bae89df0 · cknitt + Claude · Nov 07, 2026, 10:07 UTC

Find duplicate pattern variables in a set of the bound names

Why

Each new pattern variable was compared with every variable the pattern had bound so far, and a let rec … and … group is one pattern, so n bindings cost O(n²) string comparisons: 16,000 bindings took 2.7 s. They now take 2.0 s.

The names are kept in a set next to the list of variables, in one value, so that resetting the pattern and the save and restore around or-patterns carry both.