Re: cross module optimization issues

2008-11-28 Thread Neil Mitchell
Hi I've talked to John a bit, and discussed test cases etc. I've tracked this down a little way. Given the attached file, compiling witih SHORT_EXPORT_LIST makes the code go _slower_. By exporting the print_lines function the code doubles in speed. This runs against everything I was expecting,

Re: cross module optimization issues

2008-11-28 Thread John Lato
PROTECTED] | Sent: 28 November 2008 09:48 | To: Simon Peyton-Jones | Cc: John Lato; glasgow-haskell-users@haskell.org; Don Stewart | Subject: Re: cross module optimization issues | | Hi | | I've talked to John a bit, and discussed test cases etc. I've tracked | this down a little way

RE: cross module optimization issues

2008-11-28 Thread Simon Peyton-Jones
| To: Simon Peyton-Jones | Cc: Neil Mitchell; glasgow-haskell-users@haskell.org; Don Stewart | Subject: Re: cross module optimization issues | | Neil, thank you very much for taking the time to look at this; I | greatly appreciate it. | | One thing I don't understand is why the specializations

Re: cross module optimization issues

2008-11-28 Thread pepe
On 28/11/2008, at 15:46, Simon Peyton-Jones wrote: The $f2 comes from the instance Monad (IterateeGM ...). print_lines uses a specialised version of that instance, namely Monad (IterateeGM el IO) The fact that print_lines uses it makes GHC generate a specialised version of the

Re: cross module optimization issues

2008-11-28 Thread John Lato
Yes, this does help, thank you. I didn't know you could generate specialized instances. In fact, I was so sure that this was some arcane feature I immediately went to the GHC User Guide because I didn't believe it was documented. I immediately stumbled upon Section 8.13.9. Thanks to everyone

Re: cross module optimization issues

2008-11-28 Thread Neil Mitchell
Hi instance Monad m = Monad (IterateeGM el m) where {-# SPECIALISE instance Monad (IterateeGM el IO) #-} does that help? Yes. With that specialise line in, we get identical performance between the two results. So, in summary: The print_lines function uses the IterateeGM with IO as the

Re: cross module optimization issues

2008-11-23 Thread John Lato
On Sat, Nov 22, 2008 at 6:55 PM, Don Stewart [EMAIL PROTECTED] wrote: jwlato: Is this , since it is in IO code, a -fno-state-hack scenario? Simon wrote recently about when and why -fno-state-hack would be needed, if you want to follow that up. -- Don Unfortunately, -fno-state-hack

Re: cross module optimization issues

2008-11-22 Thread Don Stewart
jwlato: On Wed, Nov 19, 2008 at 4:17 PM, Simon Peyton-Jones [EMAIL PROTECTED] wrote: | I'm compiling with -O2 -Wall. After looking at the Core output, I | think I've found the key difference. A function that is bound in a | where statement is different between the monolithic and split

RE: cross module optimization issues

2008-11-21 Thread Mitchell, Neil
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Simon Peyton-Jones Sent: 21 November 2008 10:34 am To: John Lato Cc: glasgow-haskell-users@haskell.org; Don Stewart Subject: RE: cross module optimization issues | This project is based on Oleg's Iteratee

RE: cross module optimization issues

2008-11-21 Thread Simon Peyton-Jones
| This project is based on Oleg's Iteratee code; I started using his | IterateeM.hs and Enumerator.hs files and added my own stuff to | Enumerator.hs (thanks Oleg, great work as always). When I started | cleaning up by moving my functions from Enumerator.hs to MyEnum.hs, my | minimal test case

RE: cross module optimization issues

2008-11-19 Thread Simon Peyton-Jones
| I'm compiling with -O2 -Wall. After looking at the Core output, I | think I've found the key difference. A function that is bound in a | where statement is different between the monolithic and split | sources. I have no idea why, though. I'll experiment with a few | different things to see

Re: cross module optimization issues

2008-11-18 Thread John Lato
On Sat, Nov 15, 2008 at 10:09 PM, Don Stewart [EMAIL PROTECTED] wrote: jwlato: Hello, I have a problem with a package I'm working on, and I don't have any idea how to sort out the current problem. One part of my package is in one monolithic module, without an export list, which works fine.

cross module optimization issues

2008-11-15 Thread John Lato
Hello, I have a problem with a package I'm working on, and I don't have any idea how to sort out the current problem. One part of my package is in one monolithic module, without an export list, which works fine. However, when I've started to separate out certain functions into another module,

Re: cross module optimization issues

2008-11-15 Thread Don Stewart
jwlato: Hello, I have a problem with a package I'm working on, and I don't have any idea how to sort out the current problem. One part of my package is in one monolithic module, without an export list, which works fine. However, when I've started to separate out certain functions into