Re:When Does Point-Free Notation Make Code More Readable?
by fiatjaf on Friday September 29, 2017 @10:59AM
(#15365863)
Go argue with Haskell benchmarks. Functional programming is slow.
Re:When Does Point-Free Notation Make Code More Readable?
by KirinDave on Friday September 29, 2017 @11:48AM
(#15366312)
What?
Haskell's competitive with everything but hand-tuned C code, consistently.
In a world where Python and Javascript are credible languages to orchestrate numeric computing, it seems ludicrous to imply that Haskell, which has superior code generation to these options in nearly every particular, is somehow "too slow."
Re:When Does Point-Free Notation Make Code More Readable?
by mrkgnao on Friday September 29, 2017 @11:34AM
(#15366181)
I won't comment on Haskell's speed here, but function composition can't possibly be making Haskell less faster.
The reason is simple: the compiler inlines the composition operator in the vast majority of (probably all?) cases, since the Haskell standard library source code marks it with an INLINE pragma:
-- | Function composition.
{-# INLINE (.) #-}
(.) :: (b -> c) -> (a -> b) -> a -> c
(.) f g = \x -> f (g x)
http://hackage.haskell.org/package/base-4.10.0.0/docs/src/GH....
Re:When Does Point-Free Notation Make Code More Readable?
by lmm on Friday September 29, 2017 @11:23AM
(#15366073)
Huh? Haskell does very well in the shootout, better than JavaScript and often comparable with C.
Re:When Does Point-Free Notation Make Code More Readable?
by mattnewport on Friday September 29, 2017 @11:10AM
(#15365957)
Haskell is not slow because of point free style. C++ generally won't suffer any performance penalty for point free style in an optimized build. If you think you have specific examples otherwise I'm happy to discuss them.
Tangent but this is one reason C++ works nicely with a more functional style with lambdas - the compilers are pretty good about optimizing away any overhead resulting from function composition etc.