
On 12/18/06, Bulat Ziganshin
Hello Sebastian,
Monday, December 18, 2006, 10:58:52 PM, you wrote:
Yes, if you just write naive Haskell code it will probably be slower than C, but why on earth would you do that? There are significant benefits (less bugs, better security) of using Haskell over C, and the only benefit of C (speed) can be achieved where it matters by writing low-level imperative style Haskell, or calling C directly.
no. it seems that you never tried to write such code and believe someone else who's said that such code may be written. try to write something very simple, like summing bytes in memory buffer, before you will do any conclusions
Clearly non-trivial libraries such as Data.Bytestring and various of your own libraries coped just fine with low level programming in Haskell. As I said, you may write the imortant bits in C, or resort to using Ptr's etc (or slightly better, the ST monad if possible). in Haskell. The fact that you, for performance reasons, are forced to use a tedious and error prone style in a small part of the code is no reason to willingly choose to use it everywhere. And a small amount of syntactic convenience for this style of programming is certainly not a very good reason to use C. Now, there are a few apps that don't really have any hot spots, but GPG seems like a poster-child case for hot-spot optimization. Use a high level language to get it RIGHT first, then optimize the hot spots. And as I said, the problems with the current project seems to be that they have issues with correctness, not performance. /S -- Sebastian Sylvan +46(0)736-818655 UIN: 44640862