On Sun, Dec 28, 2008 at 1:38 AM, Thomas DuBuisson <
thomas.dubuis...@gmail.com> wrote:

>       getNthWord n bs@(PS ptr off len) =
>               inlinePerformIO $ withForeignPtr ptr $ \ptr' -> do
>               let p = castPtr $ plusPtr ptr' off
>               peekElemOff p n
>
> But even this low level code seems to be excessively slow with 33% of
> the MD5 run time attributed to this function.  I ment to investigate
> this a couple months ago but have had zero time.
>

The overhead here is very probably caused by withForeignPtr. In similar
cases, I've seen much better performance from hoisting this to the outside
of a loop.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to