Now, let's consider a performance problem in JavaScript that happens when we're dealing with large arrays and applying several map/filter/reduce operations. If you start with an array and apply such operations (via chaining, as we saw earlier in this chapter), you get the desired result, but many intermediate arrays are created, processed, and discarded—and that causes delays. If you are dealing with short arrays, the extra time won't make an impact, but if you are processing larger arrays (as in a big data process, maybe in Node, where you're working with the results of a large database query), then you will have cause to look for some optimization. We'll do this by learning about a new tool for composing functions: transducing ...
Transducing
Get Mastering JavaScript Functional Programming - Second Edition 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.