Auto merge of #29763 - nikomatsakis:mir-29227, r=nikomatsakis
The older algorithm was pretty inefficient for big matches. Fixes #29227. (On my computer, MIR construction on this test case goes from 9.9s to 0.025s.) Whereas before we had a loop like: - for all outcomes of the test we are performing - for all candidates - check whether candidate is relevant to outcome We now do: - for all candidates - determine which outcomes the candidate is relevant to Since the number of outcomes in this case is proportional to the number of candidates, the original algorithm turned out to be O(n^2), and the newer one is just O(n). This PR also does some minor speedups by eagerly mirroring all patterns, so that we can just pass around `&Pattern<'tcx>`, which makes cloning cheaper. We could probably go a bit further in this direction. r? @Aatch
Showing
src/test/run-pass/issue-29227.rs
0 → 100644
此差异已折叠。
想要评论请 注册 或 登录