Description
I was curious about the relative performance of lots of declarations vs. modules vs. packages. I wrote a benchmark that creates a Stack project with some number of those things and times how long it takes to build. The raw results from 1 to 64 are available in this Google doc. Here they are graphed:
As you can see, adding declarations or modules does not significantly increase the build time. However, the build time is linearly correlated to the number of packages. I expected this to a certain extent because packages do a lot more than modules or declarations. I didn't expect each package to add 0.6 seconds to the build time, though.
I know this isn't a problem per se, but it's unfortunate that building 10 packages incurs a 6 second performance penalty. I don't have any insight into why Stack takes that long. Is this worth exploring, or is this just the price that must be paid to compile a Haskell package?
For this benchmark the declarations, modules, and packages are as simple as possible. Here's what a module would look like:
module P0m0 where
p0m0d0 :: ()
p0m0d0 = ()
And here's a package definition:
name: p0
version: 1.2.3
build-type: Simple
cabal-version: >= 1.10
library
default-language: Haskell98
build-depends: base
exposed-modules:
P0m0
And here's the Stack config:
resolver: lts-7.12
packages:
- p0