3 ms·
Would it work to have the data structures be copy-on-write? That way if the worker only reads then it's O(1), you just pass a reference to the worker. I imagi
by jewel 12y ago
Would it work to have the data structures be copy-on-write? That way if the worker only reads then it's O(1), you just pass a reference to the worker.
I imagine it'd be a pain to write a garbage collector for something like that.
- benjaminjackman 12y agoCopy on write is already implemented-ish with transferable objects [1] (just copy then write the copy). However, copy on write still requires allocation and for some applications that is a deal breaker. 1: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Advanced_concepts_and_examples#Passing_data_by_transferring_ownership_%28transferable_objects%29 https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers...