> "Simon Marlow" <[EMAIL PROTECTED]> writes:
> > To really match the C program, you need to use IOExts.hGetBuf and
> > IOExts.hPutBuf, and do the operations on raw characters in memory.
> > Using a UArray of Word8 would be better, but there aren't any
> > operations to do IO to/from a UArray yet (
"Simon Marlow" <[EMAIL PROTECTED]> writes:
> To really match the C program, you need to use IOExts.hGetBuf and
> IOExts.hPutBuf, and do the operations on raw characters in memory.
> Using a UArray of Word8 would be better, but there aren't any
> operations to do IO to/from a UArray yet (actually I
"Simon Marlow" <[EMAIL PROTECTED]> writes:
> Well, in Haskell each character of the string takes 20 bytes: 12 bytes
> for the list cell, and 8 bytes for the character itself
Why does a list cell consume as much as 12 bytes? Two pointers (data
and next) and a 32-bit tag field, perhaps? And a 6
> Humn... I agree with both of you, Albert and Tom. I started
> it from the
> beginning, using map and don't using reverse anymore. But the
> C program is
> still 7x faster than the Haskell one. Here is the code of the Haskell
> program:
>
> main :: IO ()
> main = do
> bmFile <- openFileEx "in
(I
think so...) why is the C program so much faster than it?
Thanks again,
-- Andre
- Original Message -
From: Albert Lai <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 18, 2001 9:42 PM
Subject: Re: Working character by character in Haskell
"Andre W B Furtado" <[EMAIL PROTECTED]> writes:
[...]
> For example, suppose function doSomeStuffWith returns its own parameter.
> Using a 1.5MB file in this case, the Haskell program ends in almost 5
> seconds, while the C program ends in less than 0.5 seconds... Is my Haskell
> program too bad