RE: turn off let floating

2004-04-30 Thread Simon Marlow
On 29 April 2004 10:17, David Sabel wrote: >> You could try out that theory by copying the definition of >> unsafePerformIO into your code, and putting an INLINE pragma on it. >> I think it's safe to do this in your case (it's not safe in general). > > That's interesting for me, in which situati

Re: turn off let floating

2004-04-29 Thread David Sabel
Hi, > > Results: > > > >method runtime (s) > >--- > >pure0.7 > >ffi 3.2 > >fastMut 15 > >ioref 23 > > I very strongly suspect that it is the unsafePerformIO that hurts > performance in the fastMut

Re: turn off let floating

2004-04-20 Thread Bernard James POPE
On Tue, Apr 20, 2004 at 01:59:33PM +0100, Simon Marlow wrote: > On 20 April 2004 12:48, Bernard James POPE wrote: > > > Results: > > > >method runtime (s) > >--- > >pure0.7 > >ffi 3.2 > >fastMut 15 > >ioref

Re: turn off let floating

2004-04-20 Thread Bernard James POPE
On Tue, Apr 20, 2004 at 02:56:36PM +0200, Ketil Malde wrote: > Bernard James POPE <[EMAIL PROTECTED]> writes: > > > Note each program was compiled with ghc 6.2 with -O2 on debian linux. > : > > main = print $ loop 1 0 > > Isn't this going to be optimized away to a constant w

Re: turn off let floating

2004-04-20 Thread Bernard James POPE
Hi Andre, > There's another way which you missed: using implicit parameters. I > remember reading a paper a while ago called Global Variables in Haskell > (sorry, don't remember the author -- Jones, perhaps?) which did similar > benchmarking to yours, and carrying around the global variable wi

Re: turn off let floating

2004-04-20 Thread Andre Pang
On 20/04/2004, at 9:48 PM, Bernard James POPE wrote: To test out the various possible ways of implementing a global counter I wrote some test cases (shown below). I hope the test cases are useful, and provide some indication of the relative performance. However, if you spot something bogus please

RE: turn off let floating

2004-04-20 Thread Simon Marlow
On 20 April 2004 12:48, Bernard James POPE wrote: > Results: > >method runtime (s) >--- >pure0.7 >ffi 3.2 >fastMut 15 >ioref 23 I very strongly suspect that it is the unsafePerformIO that hurts per

Re: turn off let floating

2004-04-20 Thread Ketil Malde
Bernard James POPE <[EMAIL PROTECTED]> writes: > Note each program was compiled with ghc 6.2 with -O2 on debian linux. : > main = print $ loop 1 0 Isn't this going to be optimized away to a constant with -O2? -kzm -- If I haven't seen further, it is by standing in the foot

Re: turn off let floating

2004-04-20 Thread Bernard James POPE
On Thu, Apr 15, 2004 at 10:43:22AM -0700, Carl Witty wrote: > > > However, if you have any suggestions about how to make a FAST > > > global counter > > > I would be very glad to hear it. From profiling it seems like > > > this code > > > is a little expensive (also it is called quite frequently)

RE: turn off let floating

2004-04-15 Thread Carl Witty
> > However, if you have any suggestions about how to make a FAST > > global counter > > I would be very glad to hear it. From profiling it seems like > > this code > > is a little expensive (also it is called quite frequently). > > You could try the FastMutInt module from GHC > (ghc/compiler/ut

RE: turn off let floating

2004-04-15 Thread Simon Marlow
> So I have code like: > >{-# NOINLINE count #-} >count :: IORef Int >count = unsafePerformIO $ newIORef 0 > >{-# NOINLINE getCount #-} >getCount :: (Int -> a) -> a >getCount f > = let nextCount > = (unsafePerformIO $ > do oldCount <- r

Re: turn off let floating

2004-04-15 Thread Tomasz Zielonka
On Thu, Apr 15, 2004 at 01:52:38PM +1000, Bernard James POPE wrote: > > However, if you have any suggestions about how to make a FAST global counter > I would be very glad to hear it. From profiling it seems like this code > is a little expensive (also it is called quite frequently). Well, I'm no

Re: turn off let floating

2004-04-14 Thread Bernard James POPE
On Tue, Apr 13, 2004 at 02:03:21PM +0100, Simon Marlow wrote: > > > On Fri, Apr 09, 2004 at 03:27:01PM +0200, David Sabel wrote: > > > > > you can turn off let-floating by compiling without optimizations, > > > i.e. without using a -O flag or using -O0 expli

RE: turn off let floating

2004-04-13 Thread Simon Marlow
> On Fri, Apr 09, 2004 at 03:27:01PM +0200, David Sabel wrote: > > > you can turn off let-floating by compiling without optimizations, > > i.e. without using a -O flag or using -O0 explicitly. > > The disadvantage is that most of all other optimizations > > ar

Re: turn off let floating

2004-04-09 Thread Bernard James POPE
On Fri, Apr 09, 2004 at 03:27:01PM +0200, David Sabel wrote: > you can turn off let-floating by compiling without optimizations, > i.e. without using a -O flag or using -O0 explicitly. > The disadvantage is that most of all other optimizations > are turned off too. That is exac

Re: turn off let floating

2004-04-09 Thread David Sabel
Hi, you can turn off let-floating by compiling without optimizations, i.e. without using a -O flag or using -O0 explicitly. The disadvantage is that most of all other optimizations are turned off too. Another possibility would be to compile your program with HasFuse http

Re: turn off let floating

2004-04-06 Thread Bernard James POPE
On Tue, Apr 06, 2004 at 09:38:38AM +0100, Simon Peyton-Jones wrote: > Strangely (and bogusly) there is no such flag in GHC6.2. Someone must > have noticed this already because it's there in the HEAD > (-fno-full-laziness), and has been since Feb 2004. Strange. Thanks, I think it would be good f

RE: turn off let floating

2004-04-06 Thread Simon Peyton-Jones
EMAIL PROTECTED] On Behalf Of Bernard James POPE | Sent: 06 April 2004 09:24 | To: [EMAIL PROTECTED] | Cc: Bernard James POPE | Subject: turn off let floating | | Hi all, | | In the documentation for System.IO.Unsafe | it says: | |Make sure that the either you switch off let-floating, |or tha

turn off let floating

2004-04-06 Thread Bernard James POPE
Hi all, In the documentation for System.IO.Unsafe it says: Make sure that the either you switch off let-floating, or that the call to unsafePerformIO cannot float outside a lambda. My question is how can you turn off let floating? I can't seem to find a flag that suggests