3 ms·
It is not efficient to use a webworker when transferring the data into it and out of it takes O(N) time.
by amelius 11y ago
It is not efficient to use a webworker when transferring the data into it and out of it takes O(N) time.
- ougawouga 11y agoNot with transferable objects.
- amelius 11y agoFrom [1]: > when transferring an ArrayBuffer from your main app to Worker, the original ArrayBuffer is cleared and no longer usable This is really too restrictive in many situations. [1] https://developers.google.com/web/updates/2011/12/Transferable-Objects-Lightning-Fast https://developers.google.com/web/updates/2011/12/Transferab...
- RandomBK 11y agoThat may be what the API requires, but is it actually implemented as a physical move/copy of memory? It sounds like they can just make the array _appear_ to be cleared, while keeping it in place in memory.
- yoklov 11y agoThe way I understand it is that they usually just move the pointer to the ArrayBuffer's underlying data store. No block copy occurs.
- apaprocki 11y agoThe new SharedArrayBuffer should solve that particular problem. Once videos are online, you should check out @naveedi's talk from JSConf 2 weeks ago.