Do modern JavaScript engines perform optimizations targeting pure functions?

94 views Asked by At

While advocating pure functions I'd like to also mention performance as an advantage and while I know that traditional functional languages heavily optimize them (I assume everything in haskell is magically memoized) I don't know what the case is for JS.

I have written a small jsperf which does prove that a non-trivial pure function is way faster than a side-effect-y one but the benchmark may be completely broken. (http://jsperf.com/automatic-memoization)

0

There are 0 answers