News for hackers. Stuff that matters.
Re:What I Wish I Knew When Learning Haskell 2.0 by igouy on Thursday April 24, 2014 @03:15PM (#7642282)
Re:What I Wish I Knew When Learning Haskell 2.0 by lomnakkus on Friday April 25, 2014 @01:27AM (#7644901)
No, that's not idiomatic Haskell code for an application. Foreign.Ptr (and companions) are hardly ever used in normal Haskell code unless you're optimizing for that last bit of performance -- and even then I'd be very hesitant about using it because of the lack of bounds checking, etc.

FWIW, I don't Don Stewart[0] would consider that idiomatic either. He just knows a bit more than the rest of us about how to squeeze more performance out of GHC-compiled code and was willing to use non-idiomatic code to do so.

Also FWIW, personally I don't think language shootouts are very informative most of the time, but... IMO they should at least use idiomatic code -- otherwise they tell you even less than they already do about what real-life performance is like.

[0] Just an example, I know he didn't contribute the particular benchmark you linked to. He did contribute a few of the other programs AFAIK. I think the following sentences also apply to (essentially) all the Haskell shootout contributors.

Re:What I Wish I Knew When Learning Haskell 2.0 by igouy on Friday April 25, 2014 @12:33PM (#7647496)
>I know he didn't contribute the particular benchmark<

This otoh: http://benchmarksgame.alioth.debian.org/u64q/program.php?tes...

>Foreign.Ptr (and companions) are hardly ever used in normal Haskell code unless you're optimizing for that last bit of performance<

Do you think "optimizing for that last bit of performance" doesn't happen in the wild?

>IMO they should at least use idiomatic code<

Provide some!

http://benchmarksgame.alioth.debian.org/play.php#contribute

GHC 7.8.2 installed, cabal 1.2 stuff available as-needed.

Re:What I Wish I Knew When Learning Haskell 2.0 by lomnakkus on Friday April 25, 2014 @02:14PM (#7648155)
> Do you think "optimizing for that last bit of performance" doesn't happen in the wild?

Of course it does, but the cost increases non-linearly and you have to find the right trade-off for the situation at hand. Do you want maintainability or absolute performance?

> Provide some!

Of course one could, but that would that accomplish? Everyone who thinks these benchmarks have value just looks at the fastest-performing version of $YOUR_LANG_BENCHMARK. Hint: Mostly it won't be idiomatic regardless of the value of $YOUR_LANG.

Re:What I Wish I Knew When Learning Haskell 2.0 by igouy on Friday April 25, 2014 @02:52PM (#7648376)
>but the cost increases non-linearly<

Do you think the source code for those optimized for the last bit of performance programs tells us something about that?

>Of course one could, but what would that accomplish?<

Could one? Perhaps there'd be complaints that your "idiomatic programs" were just naïve.

A passive website like the benchmarks game can never be enough, by itself, to educate and inform all (or even most) readers -- reading selectively is far too commonplace and errare humanum est.

The benchmarks game is a resource. There are enough examples that when someone draws a misinformed conclusion, we can usually show them a counter-example and ask them to think.

But only if someone contributes those (whatever they consider idiomatic to be) idiomatic programs as counter-examples.