Closed Bug 1045721 Opened 10 years ago Closed 4 years ago

"Using web workers" needs code improvements

Categories

(Developer Documentation Graveyard :: API: Web Workers, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: Harald, Unassigned)

Details

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?
Flags: needinfo?(hkirschner)
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
Flags: needinfo?(hkirschner)
ni/ myself to be sure this stays on my radar
Flags: needinfo?(jypenator)
Flags: needinfo?(jypenator)
Assignee: jypenator → nobody
MDN Web Docs' bug reporting has now moved to GitHub. From now on, please file content bugs at https://github.com/mdn/sprints/issues/ and platform bugs at https://github.com/mdn/kuma/issues/.
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.