Re:Magical, Mystical JavaScript Transducers
by z3t4 on Saturday June 29, 2019 @07:19AM
(#20311944)
FP works very well in short simple examples. If the for loop would be any more complex the FP solution would probable be incomprehensible.
Optimizers however love small immutable and steteless functions so FP would likely be faster then the imperative version. For example by making it run parallel, caching, inlining, etc
[ Parent
| on HN ]
Re:Magical, Mystical JavaScript Transducers
by layoutIfNeeded on Saturday June 29, 2019 @09:28AM
(#20312442)
>FP would likely be faster then the imperative version
[citation needed]
I highly doubt that even the most sophisticated JS engines would produce faster machine code from the functional spaghetti than a simple for loop.