News for hackers. Stuff that matters.
Re:Optimising Haskell for a tight inner loop by awda on Wednesday January 08, 2014 @06:57PM (#7027779)
By break0, it looks like we're just writing Haskell-ified C. (Lots of ugly, similar safety guarantees.)
Re:Optimising Haskell for a tight inner loop by thirsteh on Wednesday January 08, 2014 @07:13PM (#7027855)
Indeed. Many of the high-performance libraries like bytestring, aeson, etc. are written like this.

Haskell's performance is very good for nearly everything I write--and I don't write anything nearly that low level--but I can't deny that this is one of the uglier sides of the language.

On the other hand: In most other languages you'd just be dropping down to the C ABI (that's easy to do in Haskell, too, for that matter.) It is kind of impressive that you can write code that is as fast as C without writing C, even if it is ugly.

Re:Optimising Haskell for a tight inner loop by 1amzave on Thursday January 09, 2014 @01:38AM (#7029136)
> It is kind of impressive that you can write code that is as fast as C without writing C, even if it is ugly.

Impressive, perhaps -- but from a maintainability perspective I think I might prefer to pay the cost of jumping the language barrier to be able to write natural, comprehensible C rather than staying within one language and dealing with an unreadable jumble, even if it performs as well.

Re:Optimising Haskell for a tight inner loop by thu on Thursday January 09, 2014 @05:11AM (#7029647)
The final Haskell code, while being low-level, is not unreadable jumble. Maybe you're talking about the generated Core or the C-- code.
Re:Optimising Haskell for a tight inner loop by chongli on Wednesday January 08, 2014 @09:31PM (#7028396)
The difference is that with Haskell you can wrap a nice, clean, type-safe interface around all that ugly optimization. With C, you're still dealing with casts, null pointer checks, array bounds checks and all sorts of other tedious bug sources that Haskell users don't have to deal with -- unless there's a library bug, of course.
Re:Optimising Haskell for a tight inner loop by nightski on Wednesday January 08, 2014 @08:09PM (#7028079)
I disagree wholeheartedly on the similar safety guarantees part, Haskell still provides you with a significant amount over C in this case. But it does "look" more like it, if that means anything.