Compilation is very slow on some files due to implicit search repeatedly diverging
See original GitHub issueCompiler version
3.1.0 / 3.1.1
Minimized code
// using "org.typelevel" %% "cats-effect-kernel" % "3.3.4"
import cats.effect.kernel.Resource
import cats.syntax.apply.catsSyntaxApply
import cats.Monad
object middlewares {
def withToken[F[_]: Monad](getToken: F[Unit]): Resource[F, Unit] =
Resource.eval(getToken) *> Resource.eval(getToken)
}
Expectation
Sub-second recompilation when there are no changes in the file except whitespace.
Reality
It takes 7-8 seconds to compile this file on a fresh JVM. Recompilation also takes nearly as much, and the presentation compiler is affected as well (which is visible when you e.g. attempt to get completions in Metals).
Notes
I think the *>
call is the culprit here. Removing it fixes the issue.
Scala 2.13.8 compiles this in 2 seconds with sub-second incremental recompilations.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Swift Slow Compile Times Fix | Apple Developer Forums
Under that, there is an option "Find Implicit Dependencies", uncheck that ... Swift compiles only a handful of files and compile times improve...
Read more >Speeding Up Compilation Time with scalac-profiling
It's worth investigating why slow compiles happens as as it is often possible to fix our projects to compile faster!
Read more >Why is my Rust build so slow? - Hacker News
I would say that due to headers, massive portability baggage and a lack of a standard build system, compiling C++ is even worse....
Read more >Why is compilation very slow for Scala programs?
Some people see compile speeds that are lower than that. That's usually because they use constructs (often imported from a library) that are ......
Read more >TSConfig Reference - Docs on every TSConfig option
A file specified by exclude can still become part of your codebase due to an ... In some cases where no type annotations...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
IMO this is a severe enough regression that this qualifies as a bug. Luckily I think I have a fix: https://github.com/lampepfl/dotty/pull/14353
Your fix works 😃 tried with a
publishLocal
and this compiles much faster now.