--only-depencies saves time?

gdweber at iue.edu gdweber at iue.edu
Tue Aug 4 16:39:22 UTC 2015

Hello, Peder,

On 2015-Aug-01, Peder Jakobsen wrote:
> I’ve read the Simple Guide to Cabal at http://katychuang.com/cabal-guide/ <http://katychuang.com/cabal-guide/>

The page you are referring to does not explain the flags that
it recommends.

> It says:
> create a copy of a package by running the command
> cabal install
> Some flags can speed up this process
> --only-dependencies

Would install all the dependencies of hakyll, but not hakyll itself.
Not much of a time saver, in this case, since there are 96 packages
on which hackyll depends.  I don't really see much point in this option.

> -jN to build N packages in parallel

I have four cores, so I routinely use -j4.
It could speed up the build by not more than 400% in that case.
Generally, for a build like this, it makes good use (> 90%) of all my CPUs,
until towards the end when there are < 4 packages remaining.

> --dry-run to see what cabal plans to do (recommended)

This one might save time, because it doesn't install anything;
it just prints out what cabal would install.  Could be useful in case
you want to scan through the list, and if you see anything
that you don't want, or it's just too long, decide not to
install hakyll, for example.  (Could actually waste more of
your time, in case you decide to build the package anyway.)

I think maybe this is more useful when _not_ using a sandbox,
because you could see if the packages it would install would
conflict with some that you already have installed?

> But here’s the thing (piping a word count from —dry-run) 
> $ cabal install hakyll --dry-run | wc -l     
> 	 97
> cabal install hakyll --only-dependencies  --dry-run | wc -l
>       96
> So it takes 20+ minutes to install a package that you just want to check out for a few minutes, while your CPU melts down in the process?  I must be missing something here…?

The hakyll package is interesting and complex, and I don't see much point
in checking it out for just "a few minutes" :-)

In my case, `time cabal install -j4 hakyll` (in a sandbox) reports that
it took 13 minutes and 38 seconds.

But this is not too uncommon for installing software from source,
whether it's Haskell + cabal or C + `make configure; make; make install` ,
is it, even if we have binaries for most of the C libraries already installed?

> Thanks again for your newbie support, greatly appreciated. 
> P.J.

Thanks for asking a question that was easy enough for me to answer --
it's something that doesn't happen often on this list ;-)


> _______________________________________________
> cabal-devel mailing list
> cabal-devel at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/cabal-devel

Gregory D. Weber, Ph. D.                  http://pages.iu.edu/~gdweber/
Associate Professor of Informatics        Tel (765) 973-8420
Indiana University East                   FAX (765) 973-8550

More information about the cabal-devel mailing list