Optimization beyond the Module Border

2008-03-19 Thread Bernd Brassel
Hi all, I have noticed that there is a great difference between optimizing modules separately and all at once, e.g., with -fforce-recomp. I have had examples factors up to 15 in run time (and even different behavior in context with unsafePerformIO). Is there any option that makes ghc write out th

RE: Optimization beyond the Module Border

2008-03-19 Thread Simon Peyton-Jones
| I have noticed that there is a great difference between optimizing | modules separately and all at once, e.g., with -fforce-recomp. I have | had examples factors up to 15 in run time (and even different behavior | in context with unsafePerformIO). GHC does a lot of cross-module inlining already,

Re: Optimization beyond the Module Border

2008-03-19 Thread Bernd Brassel
Simon Peyton-Jones wrote: > GHC does a lot of cross-module inlining already, and *does* write stuff into > interface files, provided you use -O. I used -O4. Is that the bad thing? > I'm always interested in performance differences of a factor of 15 though! > Can you supply an example (as smal

Re: Optimization beyond the Module Border

2008-03-19 Thread Don Stewart
bbr: > Simon Peyton-Jones wrote: > > > GHC does a lot of cross-module inlining already, and *does* write stuff > > into interface files, provided you use -O. > > I used -O4. Is that the bad thing? There's nothing about -O2 However, I think that's ok -- it clamps -ON | N>2 to -O2 > > I'm alw

Re: [GHC] #2163: GHC makes thunks for Integers we are strict in

2008-03-19 Thread Ian Lynagh
On Tue, Mar 18, 2008 at 04:12:35PM -, GHC wrote: > > > W.f = > > \ (x_a5h :: GHC.Num.Integer) -> > > let { > > x'_sa7 [ALWAYS Just S] :: GHC.Num.Integer > > [Str: DmdType] > > x'_sa7 = GHC.Num.plusInteger x_a5h W.lvl } in > > GHC.Num.timesInteger x'_sa7 x'_sa7 > >

Re: Optimization beyond the Module Border

2008-03-19 Thread Malcolm Wallace
> I'd be interested in any progress here -- we noticed issues with > optimisations in the stream fusion package across module boundaries > that we never tracked down. If there's some key things not firing, > that would be good to know. I suspect that if all modules are compiled -O0, then you recom

Expected behavior of "deriving Ord"?

2008-03-19 Thread Conal Elliott
I have an algebraic data type (not newtype) that derives Ord: data AddBounds a = MinBound | NoBound a | MaxBound deriving (Eq, Ord, Read, Show) I was hoping to get a min method defined in terms of the min method of the type argument (a). Instead, I think GHC is producing something in

Re: Expected behavior of "deriving Ord"?

2008-03-19 Thread Duncan Coutts
On Wed, 2008-03-19 at 14:11 -0700, Conal Elliott wrote: > I have an algebraic data type (not newtype) that derives Ord: > > data AddBounds a = MinBound | NoBound a | MaxBound > deriving (Eq, Ord, Read, Show) > > I was hoping to get a min method defined in terms of the min method of >

Re: Expected behavior of "deriving Ord"?

2008-03-19 Thread Conal Elliott
Thanks for the pointers. I'd found 10.1 but hadn't noticed 10.5. So I suggest that you use an explicit Ord instance and define min/max the > way you want. > Yep. That's my solution: instance Ord a => Ord (AddBounds a) where MinBound <= _ = True NoBound _ <= MinBound =

Re: [GHC] #2163: GHC makes thunks for Integers we are strict in

2008-03-19 Thread Ian Lynagh
On Wed, Mar 19, 2008 at 05:31:08PM +, Ian Lynagh wrote: > On Tue, Mar 18, 2008 at 04:12:35PM -, GHC wrote: > > > > (don't worry, this often catches me out too. Perhaps a strict let > > should be indicated more explicitly in `-ddump-simpl`). > > I'd certainly find it useful if it was cl

Re: [GHC] #2163: GHC makes thunks for Integers we are strict in

2008-03-19 Thread Don Stewart
igloo: > On Wed, Mar 19, 2008 at 05:31:08PM +, Ian Lynagh wrote: > > On Tue, Mar 18, 2008 at 04:12:35PM -, GHC wrote: > > > > > > (don't worry, this often catches me out too. Perhaps a strict let > > > should be indicated more explicitly in `-ddump-simpl`). > > > > I'd certainly find i

Bug: GHC hangs rather than reporting an occurs check error

2008-03-19 Thread Bryan Donlan
Hi all, I've found a case where GHC will hang (consuming more and more memory) when it should report an occurs check error. The test case is at http://fushizen.net/~bd/kaos-ghc.loop.tgz - the error in question is that the arguments in the StateT instance for HOLift are reversed like so: diff --gi

Re: Bug: GHC hangs rather than reporting an occurs check error

2008-03-19 Thread Bryan Donlan
On Thu, Mar 20, 2008 at 2:38 AM, Bryan Donlan <[EMAIL PROTECTED]> wrote: > Hi all, > > I've found a case where GHC will hang (consuming more and more memory) > when it should report an occurs check error. The test case is at > http://fushizen.net/~bd/kaos-ghc.loop.tgz - the error in question is