Commit 3131803
committed
Fix inductive implicits performance regression
The fix for #6058 in #6163 caused a significant performance regression
in the inductive implicits benchmark because the use of =:= rather than
== in the divergence check was significantly slower. It is the right
test however, so we need a quicker check to rule out negative cases.
We're already computing the covering sets and sizes of the two types
being compared. tp1 =:= tp2 should entail (sz1 == sz2 && cs1 == cs2), so
the contrapositive (sz1 != sz2 || cs1 != cs2) should entail that !(tp1
=:= tp2). However the covering set and size computations were incorrect
(they missed types mentioned in bounds which should have been included,
and included symbols for unsolved type variables which should not).
This commit fixes the latter issue, which allows covering set and size
tests to be used to avoid expensive full type equality tests.1 parent afb7a8b commit 3131803
File tree
2 files changed
+22
-5
lines changed- compiler/src/dotty/tools/dotc
- core
- typer
2 files changed
+22
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4973 | 4973 | | |
4974 | 4974 | | |
4975 | 4975 | | |
| 4976 | + | |
| 4977 | + | |
| 4978 | + | |
| 4979 | + | |
| 4980 | + | |
| 4981 | + | |
| 4982 | + | |
| 4983 | + | |
4976 | 4984 | | |
4977 | 4985 | | |
4978 | 4986 | | |
| |||
4990 | 4998 | | |
4991 | 4999 | | |
4992 | 5000 | | |
4993 | | - | |
4994 | | - | |
4995 | | - | |
| 5001 | + | |
4996 | 5002 | | |
| 5003 | + | |
| 5004 | + | |
| 5005 | + | |
| 5006 | + | |
| 5007 | + | |
| 5008 | + | |
| 5009 | + | |
| 5010 | + | |
| 5011 | + | |
| 5012 | + | |
4997 | 5013 | | |
4998 | 5014 | | |
4999 | 5015 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1406 | 1406 | | |
1407 | 1407 | | |
1408 | 1408 | | |
| 1409 | + | |
1409 | 1410 | | |
1410 | | - | |
1411 | | - | |
| 1411 | + | |
| 1412 | + | |
1412 | 1413 | | |
1413 | 1414 | | |
1414 | 1415 | | |
| |||
0 commit comments