about summary refs log tree commit diff
path: root/src/libexpr/common-opts.cc
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2021-09-11T14·23+0200
committersterni <sternenseemann@systemli.org>2021-09-11T16·00+0000
commit2f750e4a14be68f275f6fe23995eb9a994e0f5de (patch)
treefa825b6379206cef791600c6df70d0bce2fa5b29 /src/libexpr/common-opts.cc
parenta63057414df62f2b680692018fddbcbeae32f15f (diff)
refactor(grfn/xanthous): avoid unnecessary recompilation r/2850
hpack is a bit dumb when generating the list of modules for a cabal
file's component if multiple of them live in the same directory.
Specifically it seems to assume that all modules in the source-dirs
of a particular component are also necessary for its compilation.

This is quite bad in the case of xanthous since both library and
executable have source-dirs: src, so all modules will be compiled
twice: Once for the library and then again for the executable
despite it depending on the library (actually 4 times in total
since we need to build a unprofiled and profiled object for each
module…).

To fix this we just move Main.hs into its own directory and change
the executable's source-dirs, so hpack doesn't get confused anymore.
Since all components now have their own source-dirs, unnecessary
redundant compilation should be down to 0. The diff of the cabal
file shows quite nicely how many module recompilation we've gotten
rid of.

Change-Id: I2df4fab9b0299b3a2b5d3005508c79b2d9796039
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3533
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Reviewed-by: grfn <grfn@gws.fyi>
Diffstat (limited to 'src/libexpr/common-opts.cc')
0 files changed, 0 insertions, 0 deletions