Functional Programming Performance


Recently watchingclean-code-javascriptAt that time, I saw some confusion about functional programming.
There is no doubt that the writing of the functional form is clearer, but map and reduce have traversed the data twice, whereas the original writing only needs to traverse once. in the case of a very large list, or the chain process is longer, is it too stupid to traverse n times? Is it necessary to sacrifice performance in order to improve a little readability?
The introduction of the ramdajs library was unnecessary and too heavy.


One of the benefits of using a functional approach is that it gives control to the language/runtime, which can better optimize the execution process, such as parallel or distributed processing, while being transparent to developers and requiring no modification.