[Haskell-cafe] fast image processing in haskell?
Bulat Ziganshin
bulat.ziganshin at gmail.com
Sat Aug 5 01:55:41 EDT 2006
Hello Chris,
Saturday, August 5, 2006, 3:47:19 AM, you wrote:
>> in Haskell before blitting the data (whilst also retaining some
>> semblance of functional programming...)
the best way to optimize Haskell program (with current technologies)
is to rewrite it in strict & imperative manner:
>> cam_snap_3 cam f x =
>> let end = snap_size cam
>> loop ptr n x | ptr `seq` n `seq` x `seq` False = undefined
>> | n >= end = return x
>> | otherwise = do
>> r <- peek ptr
>> g <- peek (advancePtr ptr 1)
>> b <- peek (advancePtr ptr 2)
>> loop (advancePtr ptr 3) (n+3) (f r g b n x)
>> in loop (cam_img cam) 0 x
--
Best regards,
Bulat mailto:Bulat.Ziganshin at gmail.com
More information about the Haskell-Cafe
mailing list