Skip to content

Use Binary to save/restore persistent build config - #2076

Merged
ttuegel merged 4 commits into
haskell:masterfrom
ttuegel:binary-lbi
Aug 30, 2014
Merged

ttuegel merged 4 commits into
haskell:masterfrom
ttuegel:binary-lbi

Conversation

@ttuegel

@ttuegel ttuegel commented Aug 29, 2014

Copy link
Copy Markdown
Member

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.

@ezyang

ezyang commented Aug 29, 2014

Copy link
Copy Markdown
Contributor

LGTM.

@ttuegel

ttuegel commented Aug 29, 2014

Copy link
Copy Markdown
Member Author

Unfortunately, build fails on GHC 7.4 because of some name collision between Prelude and Control.Exception. (That's easy to fix.) And, it's failing on GHC 7.2 because of some issue with Binary and the standalone-derived Generic instance for Version. Apparently, binary isn't as compatible with GHC 7.2 as the docs claim. I'll try an earlier version, but for now this is broken.

@23Skidoo

Copy link
Copy Markdown
Member

Looks good in general. I think that we can drop GHC 7.2 compatibility for the next Cabal release - 7.2.2 was released in November 2011, so by the time GHC 7.10.1/Cabal 1.22 will come out, it will be >3 years old.

@23Skidoo

Copy link
Copy Markdown
Member

Maybe we can convince GHC to use binary package databases?

I believe that GHC already does that.

@ttuegel

ttuegel commented Aug 29, 2014

Copy link
Copy Markdown
Member Author

I just checked, and on my system with GHC 7.8.3, /usr/lib/ghc-7.8.3/package.conf.d/*.installedconf are all the products of Show InstalledPackageInfo.

@23Skidoo

Copy link
Copy Markdown
Member

@ttuegel

Interesting, I have no .installedconf files, only .conf:

$ ls ~/.ghc/i386-linux-7.8.2/package.conf.d | ag 'installedconf$' | wc -l
0
$ ls ~/.ghc/i386-linux-7.8.2/package.conf.d | ag 'conf$' | wc -l 
40

And there's also a binary cache file in that directory, package.cache.

@ttuegel

ttuegel commented Aug 29, 2014

Copy link
Copy Markdown
Member Author

@23Skidoo I have a package.cache too, but it seems to only pertain to boot libraries. This must be something about how my distro packages things; I'll investigate more there.

PackageTests has its own version of getPersistBuildConfig which does not
check which version of Cabal created dist/setup-config. Now that the
LocalBuildInfo is written with Binary, this version needed to be
updated, too.
ttuegel added a commit that referenced this pull request Aug 30, 2014
Use Binary to save/restore persistent build config
@ttuegel
ttuegel merged commit 430e852 into haskell:master Aug 30, 2014
@ttuegel
ttuegel deleted the binary-lbi branch August 30, 2014 22:31
@23Skidoo 23Skidoo mentioned this pull request Aug 31, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants