-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
grain compile very slow #648
Comments
The current binary downloads do unfortunately run slowly, as they are a packaged node application with the compiler compiled from OCaml to Javascript (using JS_of_OCaml). It will take a long time on the first run as it is compiling the standard library modules (and is also running as a JS app). If you are able to compile the source code, it will take a while as it needs the OCaml compiler and toolchain, but after that you should find compiles are pretty fast. |
Thanks for your consideration! So I did pnpm install -g yarn esy
git clone git://github.com/grain-lang/grain path/to/grain
cd path/to/grain
yarn compiler build which ran for like 30 mintues but then stopped with error:
... which is unfortunate. Any ideas what went wrong? It looks like
is what caused the error. Now I don't have a |
I don't have an immediate answer, but those errors seem to be related to an different versions of C++11, typically seen when different components are compiled with different versions of GCC, typically a library compiled with an earlier version linking to a program compiled with a later version. |
In that case, how could I find out about the required or conflicting versions? |
That's the hard part :(. Can I check though, which version of node are you running? |
My Node version is 15.12.0 |
I can't guarantee this will help, but node 14 is the version we recommend. If you use NVM you could switch to 14 to see if that helps? |
OK hang on, it'll take some time again... Update Nope, didn't work with node 14.16.1. This time around |
The compile being that fast is worrying. The reason we put out the binaries is although they are slow they let us avoid these compile time warnings. I'll ping the rest of the team as I think we include some binaries in the source build too for some of the build tools and this may be where the issue is. You may want (if you're feeling brave) to clear out the previously built artifacts such as node_modules and your esy cache. I'm going to get Linux Mint set up in a VM to see if I could reproduce the issue - what version are you running? |
This looks similar to #569 |
My thinking exactly, so I went and re-installed yarn and esy and also trashed The OS version is Linux Mint 19.3 Tricia so not the newest one. |
Yes it does the last few output lines read the same. Where does this |
Can you run cc -v (or gcc -v) and tell me the C compiler version you're running please? |
Here you go:
(so no |
I'm seeing 30+ second compile times on the 2nd, 3rd, 4th hello world examples. Not sure if that's typical of indicative that I'm seeing this same issue. I'm using Node version v14.16.0 and
|
No surprise but I get the same compile error on a clean install of Mint 19.3. Now I can reproduce the problem I'll see if I can fix it. |
@loveencounterflow I'm going to carry on with this issue in #569 as that's about compiling grain. @benracine the performance problem you see is the linking phase which does take around this amount of time with the JS version of the tools. |
Same on Windows. 16 seconds for nth compile of hello.gr. |
Yes, we are aware of the performance of the packaged binaries. Static linking is ~80% of that time. |
I don't see this being predominantly static-linking time in my measurements. Evidently, the times are far too slow... Binary from https://grain-lang.org/docs/getting_grain#MacOS-x64---Homebrew, downloaded just now. 2014 MacbookPro here, running MacOS Catalina 10.15.5: $ time grain hello.gr --no-link real 0m43.047s $ time grain hello.gr real 0m49.597s |
Fast compile times can be achieved by building the compiler from source. You can find instructions here: https://grain-lang.org/docs/getting_grain#Building-Grain-from-Source We plan to ship fast native binaries later this year / early next year. |
@ospencer Hi 👋 , I see this issue is Open. May I ask what the status is? Are there still these slowness issues with the complier? Any luck shipping faster binaries? Thank you. |
Hey @emummel20! This will be resolved in the next version of Grain, v0.5.0. Should be out within a few weeks :) |
On Linux Mint, I installed grain using the command line from the docs which got me
grain
0.3.1. When I rungrain demo.gr
orgrain compile demo.gr
with a file containing onlyprint("helo world")
, some*.wasm
files are produced undertarget/
, but then the executable isseemingly stuck and does not print anything to the terminal.silent for around 10 minutes or so and only then prints out the message; re-running the same command on an unchanged file still takes almost a minute. Is this to be expected?The text was updated successfully, but these errors were encountered: