The previous chapter introduced us to web workers, highlighting the powerful capabilities of these components. This chapter shifted gears and focused on the "why" aspect of parallelism. We kicked things off by looking at some aspects of functional programming, and how they lend themselves to concurrent programming in JavaScript.
We looked at the factors involved in determining the viability of executing a given operation concurrently across workers. Sometimes, there's a lot of overhead involved with taking apart a large task and distributing it to workers as smaller tasks. We implemented some generic utilities that can help us with the implementation of concurrent functions, encapsulating some of the associated concurrency boilerplate.
Not all problems are well-suited for a concurrent solution. The best approach is to work top-down, seeking out the embarrassingly-parallel problems as they're the low-hanging fruit. We then applied this principle to a number of map-reduce problems.
We...