Re: Is there a non-blocking version of hGetArray?

2004-10-03 Thread Peter Simons
Simon Marlow writes: I'm surprised if pointer access to memory is slower than unsafeRead. You were right. Now that I have made some tests, the problem turned out to be elsewhere. Pointer access is not to blame. ;-) Peter ___ Glasgow-haskell-users

Bools are not unboxed

2004-10-03 Thread Tomasz Zielonka
Hello! I was playing with monadic looping a'la replicateM_ and I created this function: for :: Int - IO () - IO () for 0 _ = return () for n x = x for (n - 1) x Compiled with -O2, it is really fast and makes no unnecessary allocations. Tested with this main main = for 1000

Re: Bools are not unboxed

2004-10-03 Thread Tomasz Zielonka
On Sun, Oct 03, 2004 at 03:07:01PM +0200, Tomasz Zielonka wrote: Then I noticed the cause: GHC.Prim.# returns a boxed, heap allocated Bool, and so do other primitive comparison operators. Would it be difficult to add Bool unboxing to GHC? Maybe it would suffice to use preallocated

Re: Bools are not unboxed

2004-10-03 Thread Carsten Schultz
Hi Tomasz! On Sun, Oct 03, 2004 at 03:07:01PM +0200, Tomasz Zielonka wrote: Hello! I was playing with monadic looping a'la replicateM_ and I created this function: for :: Int - IO () - IO () for 0 _ = return () for n x = x for (n - 1) x Compiled with -O2, it is really

Re: Bools are not unboxed

2004-10-03 Thread Tomasz Zielonka
On Sun, Oct 03, 2004 at 04:03:55PM +0200, Carsten Schultz wrote: Hi Tomasz! Hi Carsten! To my surprise, it was much slower and made many allocations: [... Then I noticed the cause: GHC.Prim.# returns a boxed, heap allocated Bool, and so do other primitive comparison operators.

hWaitForInput and timeouts

2004-10-03 Thread Peter Simons
Hi, I have another I/O problem. I need to time out when a Handle blocks forever. I am using hWaitForInput anyway, so that shouldn't be a problem, but the documentation says that using this feature will block all IO threads? Is it much work to fix this? I _could_ forkIO a racer thread myself, of