
On 8/21/07, Stefan O'Rear
Currently, it's never worse. GHC's backend is about as good as GCC; most of the optimiations it doesn't do are not possible for GCC because of various lack-of-information problems (the stack pointer never aliases the heap pointer, stuff like that). It's conceivable that at some point -fasm will be faster, because you have the possibility of much more accurate aliasing information inside the compiler, than can be coded in C. In the meantime, note that the runtime difference is less than 3% and the compile time difference is over 100%, so it's only worthwhile if you expect *this version* of your program to be used more than 30 times, ie releases only.
Wait, you're saying that ghc can produce "pure" c-code, that doesnt contain any assembly code, and that runs as fast as ghc code that does contain assembly? Sooo.... if I was feeling "evil", could I take this c-code and pipe it into something that turns it into C#??? If it contains lots of macros (or any macros at all perhaps...), this becomes non-trivial, but otherwise I think most things in C can be mapped fairly trivially to C#? (It's a one-way mapping of course, eg "delete" in C is simply dropped when mapped to c#). (Not that I have any good reason to do this, simply... fun).