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
Performance improvement: single parser instance #254
Conversation
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.
Awesome!
build.sbt
Outdated
"org.typelevel" %%% "cats-free" % catsV | ||
"org.typelevel" %%% "cats-parse" % catsParseV, | ||
"org.typelevel" %%% "cats-free" % catsV, | ||
"org.typelevel" %%% "shapeless3-deriving" % "3.0.1" |
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.
It seems unused
case Right(value) => value | ||
case Left(e) => Validated.invalidNec(LexerError[S](e.wrapErr)) | ||
} | ||
def fromString[S[_]: Comonad](parser: String => ValidatedNec[ParserError[S], Ast[S]], script: String): ValidatedNec[ParserError[S], Ast[S]] = |
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.
It seems useless now
} | ||
} | ||
|
||
def natParser[S[_] : LiftParser : Comonad, K[_] : Comonad] |
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.
Code formatting, braces seem strange
extends Expr[F](AbilityIdExpr, ability) | ||
extends Expr[F](AbilityIdExpr, ability) { | ||
|
||
def mapK[K[_]: Comonad](fk: F ~> K): Expr[K] = |
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.
Maybe better return AbilityIdExpr[K]
?
Use one parser instance for performance reasons.
Performance was increased both for jvm and js builds.
JVM: from 5-7 seconds to 3 seconds
JS: from >30 seconds to 7 seconds
fixes #250