Skip to content

Commit

Permalink
Add compile perfomance test for Scala2 twiddle subtyping
Browse files Browse the repository at this point in the history
  • Loading branch information
francesconero authored and mpilquist committed Jan 9, 2024
1 parent e30ba96 commit d6a7c97
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,36 @@ class CompilationPerformanceSpec extends FunSuite {
assert(compiled.isInstanceOf[Tuple])
}

test("should subtype in a reasonable amount of time") {
val compiled = compileWithin(
q"""import org.typelevel.twiddles._
val inferred =
1 *: 1 *: 1 *: 1 *: 1 *: 1 *: 1 *: 1 *:
1 *: 1 *: 1 *: 1 *: 1 *: 1 *: 1 *: 1 *:
1 *: 1 *: 1 *: 1 *: 1 *: 1 *: 1 *: 1 *:
1 *: 1 *: 1 *: 1 *: 1 *: 1 *: 1 *: 1 *:
1 *: 1 *: 1 *: 1 *: 1 *: 1 *: 1 *: 1 *:
1 *: 1 *: 1 *: 1 *: 1 *: 1 *: 1 *: 1 *:
1 *: 1 *: 1 *: 1 *: 1 *: 1 *: 1 *: 1 *:
1 *: 1 *: 1 *: 1 *: 1 *: 1 *: 1 *: 1 *:
EmptyTuple
type Expected =
Int *: Int *: Int *: Int *: Int *: Int *: Int *: Int *:
Int *: Int *: Int *: Int *: Int *: Int *: Int *: Int *:
Int *: Int *: Int *: Int *: Int *: Int *: Int *: Int *:
Int *: Int *: Int *: Int *: Int *: Int *: Int *: Int *:
Int *: Int *: Int *: Int *: Int *: Int *: Int *: Int *:
Int *: Int *: Int *: Int *: Int *: Int *: Int *: Int *:
Int *: Int *: Int *: Int *: Int *: Int *: Int *: Int *:
Int *: Int *: Int *: Int *: Int *: Int *: Int *: Int *:
EmptyTuple
inferred: Expected""",
10.seconds
)

assert(compiled.isInstanceOf[Tuple])
}

private val toolbox = {
val toolbox = currentMirror.mkToolBox()
// warmup
Expand Down

0 comments on commit d6a7c97

Please sign in to comment.