[ANN] cabal-buck2 0.6.0.0: now with per-module compilation

We’ve just made a new release of cabal-buck2, the Cabal extension that lets you use Buck2 as the build system for a Cabal project. There are some fairly major improvements in this release:

  • Most notably, thanks to @michaelpj, Buck2 can now compile modules separately instead of using --make, unlocking significant extra parallelism including across package boundaries. We provide a GHC worker that caches and shares hi files across compilations, mitigating the extra cost of per-module compilation compared with --make. We’re calling this feature experimental for now so it’s not enabled by default, but it’s easy to try it out. See below for some performance results.
  • The support code is now bundled with cabal-buck2 and unpacked automatically, so there’s no need to manage a separate clone of the haskell-buck2 repo any more.
  • There are now a couple of Buck2-specific fields in .cabal for specifying more accurate dependencies: x-buck2-run-tool-depends and x-buck2-ignore-build-tool-depends for refining Cabal’s build-tool-depends, and x-buck2-splice-depends for refining build-depends when using TemplateHaskell.
  • Various other changes and fixes described in the changelog.

Here are some build times for compiling HLS, comparing cabal, Buck2 with --make, Buck2 per-module, and cabal repl. The results are for a clean build, and incremental builds that modify something central (hub-api), nothing at all (noop), something central but inconsequential (hub-comment), and a leaf module (leaf).

Build times for haskell-language-server

For HLS, Buck2 is significantly faster than Cabal in all cases, and sometimes even beats cabal repl on recompiles. There are measurements for some other projects in the README.

Please try it out and let us know how you get on!

12 Likes

Why do you think it beats cabal repl on recompiles sometimes? This is great. “But the package boundary!” was always a refrain people used to avoid being organized and having good code with packages.

I think it’s because GHCi re-typechecks all the interfaces on a :reload, but I haven’t confirmed that.