-
-
Notifications
You must be signed in to change notification settings - Fork 269
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
Changes for cran 226 #1087
Changes for cran 226 #1087
Conversation
@bgoodri after the |
@andrjohns would those changes have been from the lexer-patch branch? |
No, the |
The javascript parser is taking several minutes to fail (without a helpful error message) on some complicated rstanarm models, which I don't remember happening before. Are we sure we got the right deconflicted stanc.js? This is true even if I first canonicalize them with CmdStan 2.33, such as
is not working. |
@bgoodri I tested locally and with a github actions run: https://github.com/stan-dev/rstan/actions/runs/6117301408 And I can't replicate the failure. The parser can be a bit slow with rstan 2.26, but is improved significantly with the 2.31 parser (several optimisations had been made). But if you're not sure then just revert to using Additionally I saw that you moved the The original PR is here: #1047 and the relevant issue here: #1046 |
Does fe8e55a look right? When I first try V8, then the Stan programs in rstanarm parse. Slow is tolerable but less so failing on Stan program that the C++ parser parsed. But the RStudio editor tries to parse after every keystroke, so slow is not ideal. @WardBrian Can a javascript parser from 2.32 be created that has a quicker option to just parse and return a status code or error message that does not go on to generate C++ or anything that would waste milliseconds? |
I don't think this is important enough to be a blocker for 2.26. Why not just revert to V8, make the submission, and we can sort this out later? |
It actually did get accepted to CRAN without the V8
…On Fri, Sep 8, 2023 at 1:34 AM Andrew Johnson ***@***.***> wrote:
Does fe8e55a
<fe8e55a>
look right? When I first try V8, then the Stan programs in rstanarm parse.
Slow is tolerable but less so failing on Stan program that the C++ parser
parsed. But the RStudio editor tries to parse after every keystroke, so
slow is not ideal. @WardBrian <https://github.com/WardBrian> Can a
javascript parser from 2.32 be created that has a quicker option to just
parse and return a status code or error message that does not go on to
generate C++ or anything that would waste milliseconds?
I don't think this is important enough to be a blocker for 2.26. Why not
just revert to V8, make the submission, and we can sort this out later?
—
Reply to this email directly, view it on GitHub
<#1087 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZ2XKTFH4QNSP5SAB3QSNDXZKU57ANCNFSM6AAAAAA4PGX6Q4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Great! But just a reminder that the StanHeaders 2.32 submission will currently fail revdeps since you've moved the You'll need to either revert to having |
Yeah, we are going to have to do something about that, as well as the V8 / QuickJSR thing. V8 is a problem for some Linux servers and CRAN doesn't want packages to rely to heavily on it. But if people can write Stan programs that QuickJSR does not parse (on some OS?), then it seems like we have to at least have a V8 option. |
Whichever approach we use doesn't have to be permanent, just enough to get past the large version jump. Did you have a preference for either of the two options I mentioned? If you let me know which one you prefer then I can put together a PR for the 2.32 CRAN submission |
I think what we have now in develop, fe8e55a , would work, right? It does a |
Yep as long as the Would you be able to submit an |
Theoretically, though from my previous experience the majority of the time is actually spent in the front-end of the compiler, so I doubt this would have the desired effect. To add another data point:
So it's definitely a big slowdown to use QuickJS, but it does seem to eventually work. If your results are much worse @bgoodri, is it possible you're using a QuickJS which was compiled with debug flags (like this issue: r-lib/pkgbuild#154)? |
Here are the times with QuickJSR & 2.32: > system.time(t <- rstan::stanc("~/Downloads/jm.txt"))
user system elapsed
13.627 0.148 13.793 |
@andrjohns if there is a easy way for me to get 2.32 I can run it on my machine so we have consistent hardware behind those numbers (that seems about right, though) |
There are pre-built binaries or source packages in the latest actions run from the |
And as another interesting comparison point, using the C bytecode sources I get the following timings:
|
In most cases, a few seconds of compile time does not matter, but I am a bit worried about RStudio's quasi realtime syntax checking getting a backlog of calls to the javascript parser that take seconds rather than milliseconds. |
Also, @andrjohns if we had a StanHeaders based on 2.32, couldn't we have rstantools call the canonicalizer on the .stan files as part of the package's Makevars{.win} before it generates the C++? It seems like that would reduce the number of CRAN packages that require manual intervention to migrate their array syntax. |
Thanks @andrjohns - my machine was ~3.7x faster with 2.32's javascript parser. This is actually super nice for me to see, I was only ever directly profiling the native executable, so the fact that the JS also got so much faster over those versions is really nice. |
Yep, this was discussed over here: stan-dev/rstantools#113 |
Are you able to then write the updated file back to disk? If not, this strategy wouldn't work if StanHeaders updated to a version past 2.33, where the old syntax is completely removed (i.e., even the cannonicalizer won't necessarily recognize it) |
Absolutely, this transition away from V8 wouldn't really be all that feasible without them, so the work is definitely appreciated! |
Summary:
These are Andrew's changes, of which the substantive ones are already in develop I think but this branched off an earlier point.
Intended Effect:
Get RStan 2.26 CRAN-ready
How to Verify:
Side Effects:
Documentation:
Reviewer Suggestions:
Copyright and Licensing
Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company): Columbia University
By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses: