Open fommil opened 2 years ago
This is still happening on 3.3.1.
Here are the files that emit the (false) warnings, and the warnings, although it is unclear if they are responsible for the slow compilation time because I can't find a Scala 3 port of scalac-profiling
. https://gist.github.com/fommil/a33fa371a1cbeecab33a2462690bec8a
I had a look at this, and the slowness is in typer, not in the match analysis, using -Ydetailed-stats
(with the code enable change). I tried to understand that further, with more trackTime
wraps, but the times weren't adding up logically. But it seems to be growing with the arity - i.e. CaseClass64
was the slowest class def to type, after 63, etc. I wonder whether it's some part of the case class desugaring that is expensive. For instance, the copy method has 64 type parameters, 64 term parameters and 64 default term arguments (and additionally those 64 default term argument getters also each have the 64 type parameters..).
I also looked at the false warning, and am dealing with that part in #18616.
Compiler version
3.1.0
Minimized code
https://gitlab.com/fommil/shapely
(the code is generated and found in the
src_managed
folder after running this command)A previous version of one of the slower files would crash the JVM even with 8GB of RAM so I gave up and refactored the code to use
.asInstanceOf
instead of explicit pattern matching.Expectation
This codebase compiles in seconds on Scala 2.13, but takes minutes in Scala 3. I would expect it to have competitive performance with Scala 2.
This code is mostly pattern matching and subtyping calculations. Although the
implicit
keyword appears a lot, there's not actually any implicit resolution happening here.