-
Notifications
You must be signed in to change notification settings - Fork 132
Extremely long compilation time for Circe module #47
Comments
I noticed long compilation, too. Probably fue to format derivation. Maybe @travisbrown has some insights. |
Yes, I can confirm it happens only for circe. I tried json4s and there's no this problem. I also tried it with circe 0.3.0-SNAPSHOT and problem seems still there. |
The Shapeless-powered fully-automatic generic derivation in circe can be very slow in some situations (see the last two items in this list for some discussion). There's work happening in Shapeless 2.3.0 that aims to improve this, and some changes I'm working on independently in circe also seem to make the situation incrementally better. For now unfortunately the best solution is to fall back to semi-automatically derived instances, which means two lines of boilerplate for every type you need to serialized / deserialize: import io.circe.{ Decoder, Encoder }, io.circe.generic.semiauto.deriveFor
implicit val myTypeEncoder: Encoder[MyType] = deriveFor[MyType].encoder
implicit val myTypeDecoder: Decoder[MyType] = deriveFor[MyType].decoder Note that the runtime performance of derived instances (using both |
When I upgraded to circe 0.4.0-RC1 the compilation time (for a very simple thing) went down from 1 minute 25 seconds to just 3 seconds. 👍 |
Nice. Hoping for a Circe 0.4 release anytime soon. |
I think this can be closed, because compilation time with Circe 0.4 is much better than before. |
Does any one else experiences an issue with extremely long compilation time?
I created small project with akka-http-json (particularly Circe) to show up a problem: https://github.com/chuwy/compile-problem/blob/master/src/main/scala/me.chuwy/example/Routes.scala#L10
If I remove
CirceSupport
from code, it compiles in a few seconds, but withimport CirceSupport._
orextends CirceSupport
it takes ~100s on this simple code chunk and >5min on more complicated. And all this even without actual decoding/encoding.The text was updated successfully, but these errors were encountered: