DEV Community

Discussion on: Parallel computation in the browser with observable webworkers

Collapse
 
tyroneneill profile image
Tyrone Neill

Great article! Crazy idea... but do you think you could split a redux stores reduces to be processed by multiple workers?

webWorkerAllTheThings

Collapse
 
zakhenry profile image
Zak Henry

Hmm interesting thought - you’d have to be very careful about how you split the work - for example splitting the store so that each worker is only working on part of the store that any action would only affect that slice of state. I’d be quite dubious of the performance cost though as state transfer and re-merging is probably comparable to the actual reducer cost.

What could be done which would be interesting is offloading all effects to parallel webworkers and keeping the reducers on the main thread. I think this would be a really nice pattern if the effect functions were computationally intensive