[Haskell-cafe] Missing Network Functions

Bryan O'Sullivan bos at serpentine.com
Sun Dec 28 11:47:14 EST 2008

On Sun, Dec 28, 2008 at 1:38 AM, Thomas DuBuisson <
thomas.dubuisson at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20081228/614a8a33/attachment.htm

More information about the Haskell-Cafe mailing list