
28 Dec
2008
28 Dec
'08
11:47 a.m.
On Sun, Dec 28, 2008 at 1:38 AM, Thomas DuBuisson < thomas.dubuisson@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.