Improving Compile Times on 0.18

I had posted a request for repos with slower compile times a few weeks back (Repos with slow compile times wanted for research), and I got around to writing up a bit on what I found.

The TL:DR of it is if you run your build with elm-make +RTS -s -RTS src/Main.elm and see a lot of time being spent in garbage collection (“GC” in the output), you can build your own version of elm-make that should dramatically improve speeds.

11 Likes

Thank you for this. I had lost the links to your compiled binaries.

Thank you so much for this. Such an improvement to the development process when things are more responsive. A real game changer!

I love how complicated “just give the process enough memory to work with” can be. :smiley:

Why is it necessary to use Haskell 7.10? I’m not using Haskell for anything else so installing an old version is not a problem, but if I did want the latest I’d rather not have to learn how to run multiple versions at the same time.

And if i understand correctly I need to add -rtsopts to the compile options - where do those go in the https://github.com/elm-lang/elm-platform/blob/master/installers/BuildFromSource.hs file?

elm-compiler master is already on 0.19.

I think the best course of action right now is to use the provided binaries and wait for 0.19 :slight_smile:

Anyone having any success with the Linux binary at https://github.com/antew/node-elm-compiler/releases/download/elm-make-files/elm-make.linux.x64? I get

~/applications/elm-make.linux.x64 +RTS -A128M -H128M -n4m -RTS Main.elm 
elm-make.linux.x64: Most RTS options are disabled. Link with -rtsopts to enable them.

which is what I get with the standard version

Sorry about that @simonh1000, I’ve updated the binary and tested it with a little dockerfile

FROM node
RUN curl -sL "https://github.com/antew/node-elm-compiler/releases/download/elm-make-files/elm-make.linux.x64" -o /elm-make && chmod +x /elm-make
RUN curl -sL "https://github.com/antew/node-elm-compiler/releases/download/elm-make-files/LongListMatch.elm" -o /LongListMatch.elm
RUN /elm-make --yes +RTS -s -A128M -RTS LongListMatch.elm

It should work correctly now!