Reading SharedArray from multiple Web Workers

In the previous recipe, we saw how data can be shared between the main thread and a single worker. This is helpful for move long-running operations on the main thread, which helps keep the UI responsive. However, it isn't taking full advantage of parallel processing. With very large datasets, breaking up the computation between many workers can be advantageous.

In this recipe, we'll see how to use multiple workers to produce portions of a result.

Get ECMAScript Cookbook 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.