Disable optimization

I have upgraded to Cabal 1.2 while still using GHC-6.4.1. In the Haskore project there is the module NewResolutions.lhs which let GHC run into extensive swapping (certainly due to excessive memory consumption) on compilation when compiled with optimization. One can say, it cannot be compiled this way. This is clearly a compiler bug, but upgrading the compiler is not an option here. Thus I used unoptimized compilation so far. Now, Cabal 1.2 seems to have optimization set by default. While it was easy to add optimization by using 'GHC-Options' field it is not obvious how to override Cabal defaults. I don't think it was a good idea to switch on optimization silently from one Cabal version to another one. It would have been better to let people configure Cabal globally and manually to use optimization.

On Wed, Feb 20, 2008 at 5:16 PM, Henning Thielemann
I have upgraded to Cabal 1.2 while still using GHC-6.4.1. In the Haskore project there is the module NewResolutions.lhs which let GHC run into extensive swapping (certainly due to excessive memory consumption) on compilation when compiled with optimization. One can say, it cannot be compiled this way. This is clearly a compiler bug, but upgrading the compiler is not an option here. Thus I used unoptimized compilation so far. Now, Cabal 1.2 seems to have optimization set by default. While it was easy to add optimization by using 'GHC-Options' field it is not obvious how to override Cabal defaults. I don't think it was a good idea to switch on optimization silently from one Cabal version to another one. It would have been better to let people configure Cabal globally and manually to use optimization.
But we definitely want optimization on by default to prevent a poor user experience, right? -- Johan

On Wed, 20 Feb 2008, Johan Tibell wrote:
On Wed, Feb 20, 2008 at 5:16 PM, Henning Thielemann
wrote: I have upgraded to Cabal 1.2 while still using GHC-6.4.1. In the Haskore project there is the module NewResolutions.lhs which let GHC run into extensive swapping (certainly due to excessive memory consumption) on compilation when compiled with optimization. One can say, it cannot be compiled this way. This is clearly a compiler bug, but upgrading the compiler is not an option here. Thus I used unoptimized compilation so far. Now, Cabal 1.2 seems to have optimization set by default. While it was easy to add optimization by using 'GHC-Options' field it is not obvious how to override Cabal defaults. I don't think it was a good idea to switch on optimization silently from one Cabal version to another one. It would have been better to let people configure Cabal globally and manually to use optimization.
But we definitely want optimization on by default to prevent a poor user experience, right?
This could be achieved by shipping Cabal with a default settings file. It's however difficult to add new default options in a later update installation.

On Thu, 2008-02-21 at 04:39 +0100, Henning Thielemann wrote:
This could be achieved by shipping Cabal with a default settings file. It's however difficult to add new default options in a later update installation.
Sure, cabal-install has a config file which contains defaults. Currently it only has a subset of configure options but we intend to make it cover the full range, so it would be possible to disable optimisation globally. If you want to help with that it's ticket #223: http://hackage.haskell.org/trac/hackage/ticket/223 Though as I said, that's probably not what we really want. Normally we do want to optimise when installing some package but not optimise while we're hacking on some bit of code. Perhaps "$ cabal install" should turn on optimisation but "$ cabal configure" should not. Would that make sense? What do people suggest? Duncan

On Wed, Feb 20, 2008 at 05:16:22PM +0100, Henning Thielemann wrote:
I have upgraded to Cabal 1.2 while still using GHC-6.4.1. In the Haskore project there is the module NewResolutions.lhs which let GHC run into extensive swapping (certainly due to excessive memory consumption) on compilation when compiled with optimization. One can say, it cannot be compiled this way. This is clearly a compiler bug, but upgrading the compiler is not an option here. Thus I used unoptimized compilation so far. Now, Cabal 1.2 seems to have optimization set by default. While it was easy to add optimization by using 'GHC-Options' field it is not obvious how to override Cabal defaults.
How about an OPTIONS -Onot pragma in the affected source file? (Putting optimization options in GHC-Options is now discouraged.)

Ross Paterson wrote:
On Wed, Feb 20, 2008 at 05:16:22PM +0100, Henning Thielemann wrote:
I have upgraded to Cabal 1.2 while still using GHC-6.4.1. In the Haskore project there is the module NewResolutions.lhs which let GHC run into extensive swapping (certainly due to excessive memory consumption) on compilation when compiled with optimization. One can say, it cannot be compiled this way. This is clearly a compiler bug, but upgrading the compiler is not an option here. Thus I used unoptimized compilation so far. Now, Cabal 1.2 seems to have optimization set by default. While it was easy to add optimization by using 'GHC-Options' field it is not obvious how to override Cabal defaults.
How about an OPTIONS -Onot pragma in the affected source file?
(Putting optimization options in GHC-Options is now discouraged.)
If you're developing and later will distribute your copy, a solution is to run ./setup configure --disable-optimization which will make all further building to be done without optimization. Adding a -0not to the .cabal or source file will make it permanent to all users of your code, disregarding of compiler version. If your modified copy only will be used by yourself, I prefer the suggestion by Ross as most of the project will be built with optimization. Cheers, Lennart Kolmodin

On Wed, 20 Feb 2008, Lennart Kolmodin wrote:
Ross Paterson wrote:
On Wed, Feb 20, 2008 at 05:16:22PM +0100, Henning Thielemann wrote:
I have upgraded to Cabal 1.2 while still using GHC-6.4.1. In the Haskore project there is the module NewResolutions.lhs which let GHC run into extensive swapping (certainly due to excessive memory consumption) on compilation when compiled with optimization. One can say, it cannot be compiled this way. This is clearly a compiler bug, but upgrading the compiler is not an option here. Thus I used unoptimized compilation so far. Now, Cabal 1.2 seems to have optimization set by default. While it was easy to add optimization by using 'GHC-Options' field it is not obvious how to override Cabal defaults.
How about an OPTIONS -Onot pragma in the affected source file?
I like to do it this way, but that pragma seems not to override the global Cabal setting. I added
{-# OPTIONS_GHC -Onot #-}
to the top of the module and I also added an invalid option, which let the compiler fail, so this pragma is indeed processed.
(Putting optimization options in GHC-Options is now discouraged.)
Hackage upload told me about.

On Wed, 2008-02-20 at 17:16 +0100, Henning Thielemann wrote:
I have upgraded to Cabal 1.2 while still using GHC-6.4.1. In the Haskore project there is the module NewResolutions.lhs which let GHC run into extensive swapping (certainly due to excessive memory consumption) on compilation when compiled with optimization. One can say, it cannot be compiled this way. This is clearly a compiler bug, but upgrading the compiler is not an option here. Thus I used unoptimized compilation so far. Now, Cabal 1.2 seems to have optimization set by default. While it was easy to add optimization by using 'GHC-Options' field it is not obvious how to override Cabal defaults.
cabal configure --disable-optimisation For the full list see: cabal configure --help
I don't think it was a good idea to switch on optimization silently from one Cabal version to another one. It would have been better to let people configure Cabal globally and manually to use optimization.
Yes, I find myself constantly using $ cabal configure --disable-optimisation It seems to me the default should be --enable-optimisation for when we're doing a full install and --disable-optimisation when just building locally as a developer. Or at least I want a short form so I don't have to type so much (eg -O0) - though with cabal's new bash command completion that's not so painful. Duncan
participants (5)
-
Duncan Coutts
-
Henning Thielemann
-
Johan Tibell
-
Lennart Kolmodin
-
Ross Paterson