Open Bug 1045721 Opened 6 years ago Updated 2 years ago
"Using web workers" needs code improvements
https://developer.mozilla.org/en-US/docs/Web/Guide/Performance/Using_web_workers#Passing_data That convoluted unit test snippet can be simplified. Also the types are similar to JSON, why is it important to go into so much detail on the types that can be provided. Another pain point is the various examples asyncEval, which is a bad use case for Web Workers (eval!) but which is the first extensive example. A nice example would be some expensive algorithm on a worker. Another good one is getting pixel data from canvas, transferring the typed array and doing some things with the colors.
Since this bug was filed, the article has been corrected and completed. Harald, can you review: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers#Passing_data_examples and see if it is better now?
Example #1 might need a line of why and where this would be useful. Example #2 is still very complex and I am not sure how far it illustrates data passing vs whatever else it does. Other ideas for examples: Physics simulation, decompression (https://github.com/ukyo/zlib-asm), crypto
ni/ myself to be sure this stays on my radar
You need to log in before you can comment on or make changes to this bug.