4 ms·
Fortunately, Transferable Objects (which didn't arrive until a bit after Web Workers) solves this :) http://updates.html5rocks.com/2011/12/Transferable-Objects
by Drakim 11y ago
Fortunately, Transferable Objects (which didn't arrive until a bit after Web Workers) solves this :)
http://updates.html5rocks.com/2011/12/Transferable-Objects-Lightning-Fast http://updates.html5rocks.com/2011/12/Transferable-Objects-L...
- afshinmeh 11y agoI didn't know this, awesome.
- amelius 11y agoIf one wants to share data with two different web-workers (doing different computations on the same immutable data), there is still a problem. Or so I suppose (?)
- Drakim 11y agoYeah, you'd have to clone the data.
- angersock 11y agoNote that IE can have some issues with transferable objects. Also note that the messages cannot encapsulate, say, closures or anything else that you can't JSON.stringify()/JSON.parse().
- rrss1122 11y agoLooks like the OP's linked example does not use this, since the sort reported that it took longer when using web workers than when it didn't use web workers, at least a full second longer. I wonder how much performance would improve if the example did use Transferable Objects.