Re:Why functional programming matters (1990) [pdf]
by lalaithion on Friday November 08, 2019 @06:01PM
(#21487822)
Is Scala really that much more performant than Haskell? I haven't done much high performance computing in either, but the Scala compiler is significantly slower than the Haskell compiler (both self hosted).
Re:Why functional programming matters (1990) [pdf]
by iLemming on Sunday November 17, 2019 @03:39AM
(#21557094)
JVM can be extremely performant, although sometimes memory hungry. I haven't done any Scala, but I've tried comparing Haskell and similar Clojure code. Most of the time it was easier to write more performant Clojure code, and accidentally write Haskell code that was not as performant. I have to admit though that my Haskell knowledge is pretty weak.
Re:Why functional programming matters (1990) [pdf]
by randomidiot123 on Friday November 08, 2019 @06:13PM
(#21487912)
Slower compilation doesn't mean slower execution. Scala has "Native" and JVM implementations with different performance characteristics. Scala is a hybrid that allows imperative code with a lower level of abstraction than Haskell, closer to hardware. Thus it is potentially more performant.
Re:Why functional programming matters (1990) [pdf]
by jolux on Saturday November 09, 2019 @12:11AM
(#21489751)
Sure, but has it been benchmarked? From what I've seen on the benchmarks game GHC is neck and neck with the JVM in most stuff, which is damn impressive. That is admittedly a silly comparison, though.
Re:Why functional programming matters (1990) [pdf]
by randomidiot123 on Saturday November 09, 2019 @01:38AM
(#21490021)
Of course they have been benchmarked. Both compile to native code, so performance can be roughly the same if the algorithms are the same. However, figuring out how to design a Haskell program that reaches maximum performance is very difficult, and the code probably won't be idiomatic.
Re:Why functional programming matters (1990) [pdf]
by jolux on Saturday November 09, 2019 @11:00AM
(#21492242)
> Both compile to native code, so performance can be roughly the same if the algorithms are the same.
Can and will are very different statements here though, particularly as the quality of a compiler makes an enormous difference in the performance of the resulting code.
Re:Why functional programming matters (1990) [pdf]
by lalaithion on Saturday November 09, 2019 @03:40PM
(#21494207)
My point is that both compilers are written in their own languages. If scala could be performant, surely the compiler would be too?
Personally, I find languages like Scala to be right there in the middle, where neither performance nor FP expressiveness is sacrificed severely.
That makes Scala flippin complex like C++ was, but it is probably the best attempt to bridge this gap if we all just want to learn "one language to rule them all" and incorporates both FP and imnperative/mutable style techniques that milk the hardware for what it's worth as well as give you the power/expressiveness of FP.
Of course one can write an operating system in Haskell... just as one can imitate functional style programming in C... or we can come up w/some "middle ground" language that takes the cake from both worlds and call that "the best".
My point is, this quest or journey for the best language/paradigm never ends and always shifts across the years as hardware develops and as we discover better ways of doing more with less (e.g. the crux of FP).
IMHO, ultimately you have to pick an appropriate language (tool) for the job at hand. If we forget that languages/programming paradigms are just tools... then, you'll forgive me for saying, we become tools ourselves. Or... fools, rather.
To me, whomever has realized this trade-off, is a true zen master of programming/engineering...not the one who espouses one paradigm/language over another. That's just me tho... YMMV.