Skip to content

reading the package db is slow

With a large number of registered packages it takes ages for ghc to read the package db and it does this every time it is run so it starts to add up.

I have a rather fast x86-64 machine and 160 registered packages. Here are some timings:

$ time ghc-pkg list > /dev/null
user    0m1.164s

$ time ghc -c does-not-exist.c 2> /dev/null
real    0m0.612s

$ time hsc2hs does-exist.hsc --cflag=--version 2> /dev/null
user    0m0.572s

So since cabal configure involves running all of the above it starts to take a while:

$ time cabal configure
Configuring cabal-install-0.4.3...
real    0m2.241s
user    0m1.916s

The obvious solution is to use a binary cache of the package db containing the most commonly needed mappings like module name -> package etc.

Trac metadata
Trac field Value
Version 6.8.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Driver
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Multiple
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information