Closed WojciechMazur closed 1 week ago
Variant of reproducer defining all 64 sealedtraitN
methods
repro-full.zip
Takes ~60s to compiles using Scala 3.3.0 / 3.3.3
The issue might be also present in 3.3.4-RC2, the full reproducer was timeouts after 5 minutes of compilation
Bisect points to 5fd810e6eda0d357b5e3e3117ad9260b237de6d5
Last good release: 3.6.0-RC1-bin-20240802-7f5e4ce-NIGHTLY First bad release: 3.6.0-RC1-bin-20240805-976133a-NIGHTLY
Based on compilation of full reproducer with timeout=240s
Variant of reproducer defining all 64
sealedtraitN
methods repro-full.zipTakes ~60s to compiles using Scala 3.3.0 / 3.3.3
The issue might be also present in 3.3.4-RC2, the full reproducer was timeouts after 5 minutes of compilation
Sounds like we'll need to backport a fix to 3.3.4-RC3
I didn't know it was in your community build. I suspect this would also have been flagged up by shapely
if it was in the list, as per #14224 // @dwijnand
ensime-tng would also be another useful one for you to consider, since it uses the presentation compiler api.
Another affected project is https://github.com/andimiller/cats-parse-interpolator - see https://github.com/scala/scala3/pull/21735#issuecomment-2401788282
The workaround for both projects is to disable pattern match analysis on the code generated code, it successfully reduces the compilation time to ~70s.
For example, replace
def work(st: SealedTrait1[A, A1]): Unit = st match {
case SealedTrait._1(v) => ???
}
with
def work(st: SealedTrait1[A, A1]): Unit = (st: @scala.unchecked) match {
case SealedTrait._1(v) => ???
}
for some definition of "successfully". That's still a huge regression compared to Scala 2.
We've observed a significant performance regression in the Open Community Build for
fommil/jzon
which now takes 4h to compile. Build logsCompiler version
3.6.0-nightly
Minimized code
The original source code contains instances for CaseClasses, SealedTraits with aritity <1, 64> and Tuples <1, 22>. The SealedTrait type definitions are defined in non-public library https://javadoc.io/doc/com.fommil/shapely_3/latest/shapely.html In case of the reproducer compilation time is 2x longer but in the original code base it skyrockets to few hours.
Zip with reproducer source code (too large to paste in the GitHub) repro.zip
Compilation times
Collected using
scala clean . && time scala compile . -S <version> --server=false
Expectation