Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codec.dropUnits is very slow to compile for large case classes #41

Closed
mpilquist opened this issue Jan 26, 2015 · 1 comment
Closed

codec.dropUnits is very slow to compile for large case classes #41

mpilquist opened this issue Jan 26, 2015 · 1 comment

Comments

@mpilquist
Copy link
Contributor

See http://stackoverflow.com/questions/28109303/dropunit-on-hlisted-codecs-doesnt-seem-to-work

The following case class didn't finish compiling in ~10m using 1.7.0-RC1:

import scodec._
import bits._
import codecs._
import implicits._

case class Big(
  a: Int,
  b: Int,
  c: Int,
  d: Int,
  e: Int,
  f: Int,
  g: Int,
  h: Int,
  j: Int,
  k: Int,
  l: Int,
  m: Int,
  n: Int,
  o: Int,
  p: Int
)

object Big {
  implicit val codec: Codec[Big] = (
    constant(bin"0000") :: int32 :: int32 :: int32 :: int32 :: int32 ::
    constant(bin"1111") :: int32 :: int32 :: int32 :: int32 :: int32 ::
    constant(bin"0000") :: int32 :: int32 :: int32 :: int32 :: int32
  ).dropUnits.as[Big]
}
@mpilquist
Copy link
Contributor Author

As of 1.7.0-SNAPSHOT, above example compiles in < 2s.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant