-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Remove PickledQuote and TastyString from library #10262
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
Remove PickledQuote and TastyString from library #10262
Conversation
00ea969
to
0e9298c
Compare
0e9298c
to
8c3178b
Compare
test performance with #quotes please |
For the following quote '{ val y: T = $x; y } We used to generate x$2.asInstanceOf[scala.internal.quoted.QuoteContextInternal].unpickleExpr[
evidence$1$_$1
](
scala.internal.quoted.PickledQuote.make(
scala.collection.immutable.Nil.::[String](
"XKGrH5iAAJe0vOuFlwAAl2DupbEpAAGeAYRBU1RzAYF5AYEkAYxldmlkZW5jZSQxJF8Kg4KBgwGDQW55AYVzY2FsYQGMcXVvdGVUeXBlVGFnAYtDb21waWxlVGltZReBiAGIaW50ZXJuYWwCgoaKAYZxdW90ZWQCgouMAYY8aW5pdD4Cgo2IF4GPAoKQhz+CjpEBg0ZvbwGHPGVtcHR5PgGJUG9zaXRpb25zAYlGb28uc2NhbGGAwZO/jLaMkoqENIw1mIGKgTOKk4X/g4IzioOghKSM/4WAdYU2hv+DgTOgF62OdYdQdYk2jYiFcJJVM6xvk3WTUDeUlaKGAOcA+oSWA9B98Ki4fsP6hJ+H+4CXhIWAkYB/r4eGgJSB"
)
,
scala.collection.immutable.Nil.::[Seq[Any] => Any](
{
def $anonfun$3(x$0: Seq[Any]): (x$2.Nested) ?=> quoted.Expr[T] =
{
def $anonfun(using evidence$2: x$2.Nested): quoted.Expr[T] = x
closure($anonfun)
}
closure($anonfun$3)
}
).::[Seq[Any] => Any](
{
def $anonfun$2(x$0: Seq[Any]): quoted.Type[T] = evidence$1
closure($anonfun$2)
}
).::[Seq[Any] => Any](
{
def $anonfun$1(x$0: Seq[Any]): quoted.Type[T] = evidence$1
closure($anonfun$1)
}
)
)
) Now we generate x$2.asInstanceOf[scala.internal.quoted.QuoteContextInternal].unpickleExpr[
evidence$1$_$1
](
"XKGrH5iAAJe0vOuFlwAAl2DupbEpAAGeAYRBU1RzAYF5AYEkAYxldmlkZW5jZSQxJF8Kg4KBgwGDQW55AYVzY2FsYQGMcXVvdGVUeXBlVGFnAYtDb21waWxlVGltZReBiAGIaW50ZXJuYWwCgoaKAYZxdW90ZWQCgouMAYY8aW5pdD4Cgo2IF4GPAoKQhz+CjpEBg0ZvbwGHPGVtcHR5PgGJUG9zaXRpb25zAYlGb28uc2NhbGGAwZO/jLaMkoqENIw1mIGKgTOKk4X/g4IzioOghKSM/4WAdYU2hv+DgTOgF62OdYdQdYk2jYiFcJJVM6xvk3WTUDeUlaKGAOcA+oSWA9B98Ki4fsP6hJ+H+4CXhIWAkYB/r4eGgJSB"
,
{
def $anonfun(x$0: Int, x$1: Seq[Any]): scala.quoted.Type[<?>] =
x$0:(x$0 : Int) @unchecked match
{
case 0 => evidence$1
case 1 => evidence$1 // TODO optimization oporunity (deduplicate arguments)
}
closure($anonfun)
}
,
{
def $anonfun(x$0: Int, x$1: Seq[Any], x$2: scala.quoted.QuoteContext)
:
scala.quoted.Expr[Any] =
x$0:(x$0 : Int) @unchecked match
{
case 2 =>
val evidence$2: x$2.Nested = x$2.asInstanceOf[x$2.Nested]
x
}
closure($anonfun)
}
) We removed the creation of all the |
test performance with #quotes please |
performance test scheduled: 6 job(s) in queue, 1 running. |
@nicolasstucki Need to rebase in order for benchmark test to succeed. |
This way we could generate somthing that is not a Seq, possibly a closure with a switch on the index.
Most pickled quotes fit in a single string. We avoid the creation of the list for single string by typing as `String | List[String]`.
This allows us to generate code without nested closures.
8c3178b
to
2a65e96
Compare
test performance with #quotes please |
performance test scheduled: 8 job(s) in queue, 1 running. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/10262/ to see the changes. Benchmarks is based on merging with master (4411811) |
Remove PickledQuote and TastyString from the library and encode the pickled quotes with an efficient interface and code generation.
pickled
can take aString
orList[String]
s if it needs more than one string. In practice, we never have more than one string.typeHole
/termHole
to type them more preciselytypeHole
/termHole
to generate fewer closures. This also helps with beta-reduction of closures with the generated code oftypeHole
/termHole
at each call site.Part of #10222