You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Poor performance when building many packages #2831
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:
I looked into this a little more this morning. I discovered that, perhaps obviously, this isn't a problem with Stack per se. I did a --verbose build with 64 packages and looked for the most time-consuming parts. It's almost entirely stuff like this:
2016-12-17 09:42:33.849443: [debug] Process finished in 1112ms: /home/taylor/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_1.24.1.0_ghc-8.0.1.20161117 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.1.0 build lib:p59 --ghc-options " -ddump-hi -ddump-to-file"
In other words, cabal build. The next worst offender is cabal configure:
I wrote a benchmark for this behavior using Cabal. The takeaway is that building a package with a cold cache takes about 1.5 seconds. With a warm cache it's about 0.5 seconds. Since this is a problem with Cabal, I opened an issue there: haskell/cabal#4175.
Activity
tfausak commentedon Dec 17, 2016
I looked into this a little more this morning. I discovered that, perhaps obviously, this isn't a problem with Stack per se. I did a
--verbosebuild with 64 packages and looked for the most time-consuming parts. It's almost entirely stuff like this:In other words,
cabal build. The next worst offender iscabal configure:I think that improving the performance of building packages will require hacking on Cabal.
tfausak commentedon Dec 18, 2016
I wrote a benchmark for this behavior using Cabal. The takeaway is that building a package with a cold cache takes about 1.5 seconds. With a warm cache it's about 0.5 seconds. Since this is a problem with Cabal, I opened an issue there: haskell/cabal#4175.