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
{{ message }}
Repository navigation
Commit 1eb91bb
Browse filesBrowse the repository at this point in the historyBrowse files
Remove the hashing fast paths from pattern matching (#8900)
#8868 made exhaustiveness checking and match compilation find constants by
hashing, because an expanded char range turned one pattern into thousands
of distinct constants. Char ranges are now one pattern each, so the hash
tables in `Parmatch.filter_all`, `Parmatch.get_mins_pats` and
`Matching.divide`, and the `const_key` that kept their keys consistent with
char/int equality, are removed. A dead `char` check in comparison
specialization goes too: `char` expands to `int` before it.
Review: How much slower do large switches compile? A switch with 1,000 int
or string cases compiles 0.02-0.03 s slower; one with 10,000 int cases takes
6.3 s instead of 3.2 s. Polymorphic variants are unaffected: 10,000 cases
take about 35 s either way, as other quadratic steps dominate.
Review: Does the output change? No. All committed snapshots are
byte-identical, and so is the JS of 1,500 fuzzer programs and the
benchmark switches.
Area: typechecker lambda
Output: unchanged
Formatting: unchanged
Formats: none
PPX: unchanged
Editor: unchanged
Tests: none, because the output is unchanged and existing tests cover the
behaviour
Measured: best of 3 bsc wall time, with -> without the fast paths: 1,000 int
cases 0.07 -> 0.09 s; 3,000 int 0.34 -> 0.63 s; 10,000 int 3.23 -> 6.27 s;
1,000 string 0.04 -> 0.07 s; 3,000 string 0.17 -> 0.52 s; 10,000 string
1.55 -> 5.38 s; 1,000 polymorphic variant 0.23 -> 0.25 s; 10,000
polymorphic variant 35.47 -> 36.45 s
Claude-Session: https://claude.ai/code/session_01JALXUyHhkDqzcB3WuW9Svo
Signed-off-by: Christoph Knittel <ck@cca.io>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
0 commit comments