Much faster Distribution.Client.Dependency.Modular.PSQ.splits #1191

Merged
merged 1 commit into from Feb 12, 2013

Conversation

Projects
None yet
4 participants
Contributor

nomeata commented Feb 11, 2013

I tried to speed up cabal-install with the file at http://anonscm.debian.org/darcs/pkg-haskell/tools/all-packages/all-packages.cabal. At first I thought I could add special handling for == dependencies. But after looking at the profile I found the attached patch to have a much greater impact.

This reduces the runtime of "cabal install --dry-run" on the file from ~12s to 2.1s.

Equivalency with previous implementation verified with QuickCheck in ghci.

Owner

tibbe commented Feb 11, 2013

This is great. Could you include the QuickCheck tests in the commit e.g. by putting them under cabal/Cabal/tests/UnitTests and reference them from cabal/Cabal/tests/UnitTests.hs.

Contributor

nomeata commented Feb 11, 2013

This is great. Could you include the QuickCheck tests in the commit e.g. by putting them under cabal/Cabal/tests/UnitTests and reference them from cabal/Cabal/tests/UnitTests.hs.

I don’t see any precedence for testing code from cabal-install in Cabal/tests – is that really what you want?

@nomeata nomeata Much faster Distribution.Client.Dependency.Modular.PSQ.splits
This reduces the runtime of "cabal install --dry-run" on a large cabal
file (550 dependencies) from ~12s to 2.1s. Equivalency with previous
implementation verified with QuickCheck in ghci.

This is a guess: The speedup is mostly due to how to the previous
entries are added to the result of the recursive call. Previously, for
every entry to be added, the whole result list is mapped over (lots of
allocations), and then each tuple is taken apart and reconstructed with
a changed right value (again, lots of allocations). The new code
assembles a function in an accumulator that represents the required
update and applies it where needed, hence building the list and tuples
only once.
895487a
Contributor

nomeata commented Feb 11, 2013

Rebased the commit with an expanded commit message.

@tibbe tibbe merged commit 895487a into haskell:master Feb 12, 2013

Member

23Skidoo commented Feb 12, 2013

cabal-install has its own test suite nowadays (cabal-install/tests).

Contributor

nomeata commented Feb 12, 2013

cabal-install has its own test suite nowadays (cabal-install/tests).

ah, not on the branch I was working on, but on master. Updating and adding test case...

Contributor

kosmikus commented Apr 28, 2013

@nomeata I know I'm late to comment, but thanks a lot for this patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment