You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When comparing codec automatic derivation with semi-automatic derivation (explicit or using JsonCodec), automatic derivation is very slow.
In each file which contains import io.circe.generic.auto._, if there is an expression like Decoder.apply[SomeType] (or any circe call which needs an implicit Decoder[T] instance), an automatically derived decoder will be generated for each implicit call site (DerivedDecoder.deriveDecoder gets called for each Decoder.apply[SomeType] call).
When comparing codec automatic derivation with semi-automatic derivation (explicit or using
JsonCodec
), automatic derivation is very slow.In each file which contains
import io.circe.generic.auto._
, if there is an expression likeDecoder.apply[SomeType]
(or any circe call which needs an implicitDecoder[T]
instance), an automatically derived decoder will be generated for each implicit call site (DerivedDecoder.deriveDecoder
gets called for eachDecoder.apply[SomeType]
call).I have reproduced the bug here:
CirceGenericAutoSpec.scala
typer phase takes6.9 seconds
CirceGenericJsonCodecSpec.scala
typer phase takes114 ms
CirceGenericSemiAutoSpec.scala
typer phase takes102 ms
The number of class files generated by
CirceGenericAutoSpec.scala
is huge compared to the other two examples.Given how inefficient automatic derivation can be in these cases, I think this behaviour should be documented here.
The text was updated successfully, but these errors were encountered: