3 ms·
> But in a production system, functional purity (no side-effects) is a means to an end, and lazy evaluation comes at a pretty extreme performance cost. In theo
by ParetoOptimal 3y ago
> But in a production system, functional purity (no side-effects) is a means to an end, and lazy evaluation comes at a pretty extreme performance cost.
In theory yes, in practice... not in my experience. Or at least, things are almost always fast enough in web backends.
> Not everyone disables lazy evaluation in production Haskell, because not everyone thinks they need to for performance, but I've definitely heard about it enough times that it seems like a relevant pattern.
Most people don't disable lazy evaluation in the way I think you mean it, but they use either BangPatterns selectively or StrictData.
Maybe there's widespread usage of `-XStrict` as well I don't know about.
Anecdotally I can say that trying to enable `-XStrict` in production caused performance issues that prevented us from trialing it further.
Laziness is frequently talked about as a negative, but it has big advantages in composition and code ordering like another reply talked about with regards to where bindings to enable truly top-down program design.
- whateveracct 3y ago> Anecdotally I can say that trying to enable `-XStrict` in production caused performance issues that prevented us from trialing it further. hah this is in many ways indirect proof that laziness-by-default is improving performance. It may even be that a rote translation to strict (which `-XStrict` does) is causing _time_ leaks, which are actually pervasive in production strict-by-default code.
- ParetoOptimal 3y ago> hah this is in many ways indirect proof that laziness-by-default is improving performance. I believe this is the case, but the times it saves you are invisble. The occurences where it bites you though are very visible and made out to be a much bigger deal than they usually are.