7

I have a small project using ghcjs, which currently has a best-case incremental recompilation time of 8 seconds, for a measly 637 lines of source code (as counted by find -L . -name '*.hs' | xargs wc -l | grep total).

The worst offender is the final Linking client/Main.jsexe step, which takes 3.8 seconds and happens on every incremental build.

The second worst offender is a Linking Template Haskell step, which takes about 2 seconds. This also happens on every incremental rebuild, and it comes from having a couple foreign import javascript declarations. Even if I move those declarations to a separate module/file which I never touch again, incremental builds from touching any file in the codebase cause this linking step to happen.

The final couple of seconds comes from actually compiling my source files. It would be great to get this down as well, but it's less of a problem.

How can I achieve a tighter compilation/feedback loop?

chi
  • 111,837
  • 3
  • 133
  • 218
ajp
  • 1,723
  • 14
  • 22
  • Regarding TH: the current TH implementation in GHCJS is rather resource intensive during compile time. It seems to help *a lot* in some cases, if it's possible, to place all your TH code in a separate module. Then you only pay for TH when you change something in that module. For larger projects that could save minutes on each compile depending on how much you rely on TH. – user2847643 Apr 12 '16 at 13:46
  • I actually do have the TH (my foreign import javascript statements) in a separate module, and I still pay the Linking Template Haskell cost on every compile, even if I touch an unrelated module. – ajp Apr 13 '16 at 04:45
  • In that case I'm not sure what else you can do except develop using GHC + webkitgtk. – user2847643 Apr 13 '16 at 07:53

0 Answers0