Chapter 7. Functional optimizations

This chapter covers

  • Indicating where functional code is performant
  • Examining the internals of JavaScript function execution
  • Implications of nesting function contexts and recursion
  • Optimizing function evaluation with lazy evaluation
  • Speeding up program execution with memoization
  • Unwinding recursive calls with tail recursive functions

We should forget about small efficiencies, say about 97% of the time ... premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.

Donald Knuth, The Art of Computer Programming

Always optimize last, or so they say. In previous chapters, you learned how to write and test your functional code; and now, nearing the end of ...

Get Functional Programming in JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.