[Haskell-cafe] some newbie FFI questions

Ketil Malde ketil+haskell at ii.uib.no
Thu Jul 1 07:16:42 EDT 2004


John Kozak <jk at xylema.org> writes:

> data Pixel a = Pixel !a !a !a deriving Show

>   I use ImageMagick to load the image, then build an Array of Pixel
>   Floats.  Building the array takes 45 seconds on a 2.5Ghz P4 with
>   code compiled -O2, which seems slow to me - are my expectations
>   unrealistic?  I've tried various UNPACK things which didn't make
>   much difference.

Are you using UArrays?  If you're going to read the whole image
anyway, they will probably be faster than the normal arrays.

Also, I read somewhere that operations are often specialized for
Double but not Float - since you talk about image loading rather than
processing, it may be worth it to use Floats to save space, even if
Doubles could be faster.

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Haskell-Cafe mailing list