On Sun, Dec 28, 2008 at 1:38 AM, Thomas DuBuisson <span dir="ltr"><<a href="mailto:thomas.dubuisson@gmail.com">thomas.dubuisson@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
getNthWord n bs@(PS ptr off len) =<br>
inlinePerformIO $ withForeignPtr ptr $ \ptr' -> do<br>
let p = castPtr $ plusPtr ptr' off<br>
peekElemOff p n<br>
<br>
But even this low level code seems to be excessively slow with 33% of<br>
the MD5 run time attributed to this function. I ment to investigate<br>
this a couple months ago but have had zero time.<br>
</blockquote><div><br>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. <br></div></div>