
Haskell Strings are a common performance bottleneck; for example when serving files in the Haskell web server I avoided the conversion to Haskell Strings altogether by reading/writing arrays of bytes (see the paper for details).
I was curious to see if this is also the case here. Therefore I just pasted the GHC implementation of openFile into Peter's suspicious module ('openFile' obtained from http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/libraries/ba se/GHC/Handle.hs---I hope this was the right one?) to be able to also profile the GHC internal openfile code. Here are the relevant parts of the resulting output of the profiler:
COST CENTRE MODULE %time %alloc
withCString' MailStore 39.1 19.7
Interesting - I just looked at the code for withCString and it is being poorly optimised. There are several layers of FFI abstraction which aren't being inlined/deforested away. Thanks for the pointer, I'll take a look at this. Cheers, Simon
participants (1)
-
Simon Marlow