haskell/cabal — pull request #2076 by ttuegel (2014-08-29 13:42:08+00:00)
Title: Use Binary to save/restore persistent build config

See #2058 and #1841. This is a big pull, but it's mostly just adding `deriving Generic` and `instance Binary a` for all the types in `LocalBuildInfo`. As I noted in #1841,
> GHC ships with binary, and since GHC 7.2, binary has a generic instance. GHC 7.2.1 was released 9 August 2011, so it just fell within our 3 year backward-compatible window! That means we can migrate to Binary instead of Read/Show with no boilerplate.

My profiling shows that allocation during a no-op build in the Cabal tree drops from 540 MB to 98 MB, an 82% reduction! The time profile shows that 98.9% of the time for a no-op build is spent in GHC, so I think this is the best we can do to speed things up on the Cabal side. (Maybe we can convince GHC to use binary package databases?) I've tested on GHC 7.8.3, as soon as it passes on Travis, I'll pull this.