Commit 46867c0
authored
Fix #20521
When using the `atoms` of a large provisional union type, significant
time is wasted computing the widened type and `lub` is invoked
repeatedly. This PR addresses this issue by splitting the caching
mechanisms for computing `atoms` and computing the widened type in
`OrType`.
As a result of this optimization, the compilation time for
`tests/pos/i20521.scala` has been reduced from approximately 40 seconds
to 6 seconds, making it comparable to Scala 2's performance.
File tree
2 files changed
+805
-6
lines changed- compiler/src/dotty/tools/dotc/core
- tests/pos
2 files changed
+805
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3701 | 3701 | | |
3702 | 3702 | | |
3703 | 3703 | | |
| 3704 | + | |
3704 | 3705 | | |
3705 | 3706 | | |
3706 | 3707 | | |
| |||
3716 | 3717 | | |
3717 | 3718 | | |
3718 | 3719 | | |
3719 | | - | |
| 3720 | + | |
3720 | 3721 | | |
3721 | 3722 | | |
3722 | | - | |
3723 | 3723 | | |
3724 | | - | |
3725 | | - | |
3726 | | - | |
3727 | 3724 | | |
3728 | 3725 | | |
3729 | 3726 | | |
3730 | 3727 | | |
3731 | 3728 | | |
3732 | | - | |
| 3729 | + | |
| 3730 | + | |
| 3731 | + | |
3733 | 3732 | | |
3734 | 3733 | | |
3735 | 3734 | | |
| |||
0 commit comments