-
Notifications
You must be signed in to change notification settings - Fork 379
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
Severe slowdown on large-ish files #2202
Comments
I was curious where the time was spent. So I downloaded the two modules and ran the experiment again adding The head and tail of the timing for the 1k case:
And then the same data for the 5k case:
The line that prints the parsing time is in
I suspect it's a quadratic slow down in the way the parser accumulates |
Yep the combination of doParse s ws com (Act action) xs
= Res (s <+> action) ws com (irrelevantBounds ()) xs and record State where
constructor MkState
decorations : SemanticDecorations
holeNames : List String
Semigroup State where
MkState decs1 hs1 <+> MkState decs2 hs2
= MkState (decs1 ++ decs2) (hs1 ++ hs2) looks deadly. We could use a |
I was just looking at replacing the |
Oh sorry a |
I was going to implement both |
I've created #2203 to address this. |
Tangentially, what's the reason for having an interpreted parser? That looks like a major performance hit to begin with. |
I can't really speak authoritatively on behalf of the idris team. I'm just some random person making some PRs lately. However, I have been following along with development since idris 1. So if you'll allow me to speculate.... It seems like the goal of idris1 was to get far enough along with the language design to be able to rewrite the compiler in idris. That gets us to idris2, which is currently only at the 0.5 milestone. It seems like the focus of idris2 currently is to get a sort of minimum viable idris language implemented. As such, core developer time seems to focus on functionality at the cost of performance. As an example of this, the compilation phases for desugaring and lowering don't apply any optimizations. Those are left entirely up to the backend author. I suspect the interpreted grammar is a hold over from idris1, which featured user extensible parsing rules. I also imagine the fastest way to get a working parser for idris2 was to translate the idris1 parser and keep the existing design. Despite the core developer focus on functionality over performance, I think the comparative benchmarks you've developed as part of smaltt will be incredibly helpful for those of us who have the time/energy to work on the performance related aspects of idris. |
I tried
time idris2 -c
on this file which has roughly 5000 lines of not-too-complex Church-encoded definitions repeated & renamed many times. It finishes in 51 seconds, that's less than 100 lines per second! The 1000 line version checks in 2.1 seconds (already very slow!), so it looks like there's an asymptotic problem.The text was updated successfully, but these errors were encountered: