-
Notifications
You must be signed in to change notification settings - Fork 3
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
Lark() is very slow #17
Comments
I'll look in to it. What version of Julia are you running and how did you implement the timer? |
I've added a:
Then modified the line (in order to debug why the program takes such a long time):
Then added before main():
The prompt doesn't come up until Lark(...) is called, so it takes what's in the @timeit... |
Oops, I've pasted the wrong line from another test program, updated comment. |
Another question is whether the alloc part in the above TimerOutput being 2.30GiB is maybe part of the issue, or whether that is O.K. |
So the time and allocations you have measured are almost all first-time compilation time. I get essentially the same result on Julia 1.5. However a second run is much faster. Using BenchmarkTools gives:
This first-time compilation cost can typically be transferred to package precompilation time if Lerche is used as part of a package, in which case the grammar is calculated once. Unfortunately Probably should also look at those tips from Tim Holy on reducing compilation time. |
I see.
Absolutely. That would be great. In any case, I think that this should be mentioned as part of the documentation.
It's worth reducing compilation time, as running from a standalone script makes development a bit easier, but compiling is not biggie I guess. Thanks a lot for looking into this. |
And a lot faster, of course. I've been playing around with a small ad hoc language, so any delay when fixing issues in the grammar and having to wait for compilation takes away from rapid development... so compilation time is worth keeping in mind. |
Just as a side note, if you're looking to play around with the grammar, you can do so in Lark, which is very quick and responsive. Once you have a satisfactory grammar, you should be able to use it in Lerche without any changes. (or very minor ones) |
Note that the compilation time is only to compile the Julia code for handling the grammar. If you are in a Julia REPL, after the first 30s wait subsequent changes to your grammar and regeneration via
|
Thanks for the suggestion. I'll do that. As an unintended product of this, I've actually added more test functions to save time and not run the entire program each time, so maybe there's something good that came out of the slow first compilation!
Unforunately, it's a bit difficult (not impossible...) for me to untangle the grammar from the code when testing sometimes, I really rely on the Julia for the functions as return values to the parser when testing, so it'd be really great to just stay in a Julia environment. |
I'm attempting to run the calc.jl example, and for some reason running Lark(...) takes a very long time. Not sure that this is on my end or how to know that. In any case, I've added a timer:
Any assistance much appreciated.
Thank you.
The text was updated successfully, but these errors were encountered: