13 Jan 2013 21:27
cabal sdist warns about optimization levels
Petr P <petr.mvd <at> gmail.com>
2013-01-13 20:27:44 GMT
2013-01-13 20:27:44 GMT
Hi all,
I'm working on a library for fast sorting of MArrays. The library is primarily about speed, so I added
ghc-options: -O2
to the cabal file. Now cabal sdist complains with:
'ghc-options: -O2' is rarely needed. Check that it is giving a real benefit and not just imposing longer compile times on your users.
I wonder:
(1) Is there a way how to disable the warning? As the main aim of the library is speed, I believe -O2 is appropriate here. And since the code is quite short, I'm quite sure the increased compile time won't be noticeable.
(2) Why does cabal complain about it at the first place? I found a reference saying the warning is adequate:
but not saying why. Maybe for complex programs -O2 prolongs compile time too much, but libraries are usually compiled once and used many times, so using -O2 for them seems reasonable in many cases.
Thanks for help,
Petr Pudlak
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe <at> haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
> (2) Why does cabal complain about it at the first place?
There's lots of programs where it makes no measurable difference
except to make compile times longer. To some extent it's to try to
break the habbit of C programmers who always default to -O2. With gcc
-O2 will almost always be significantly better than -O, but with ghc
that's not the case: -O is the sensible default (almost by definition,
to a first approximation, things that are always a win get put into
-O, things that are sometimes a win and sometimes not go into -O2).
Duncan
RSS Feed