Skip the blog:
- See it in action if you have html5 compliant browser
- Get 0.9 Here!
The bulk
After my initial 0.8 release where I dabbled into the world of web workers, Sundae still had massive performance hogs.
What did I do about it? I went on IRC and spoke to the community! David Humphrey provided some interesting insights on my issue. My problem was that although I was now using web workers my code was STILL synchronous. The solution became, remodel the workers to grab work items from a queue.
So including edge cases, my workflow became:
- queue.push called, is there a available worker?
- Yes -> use it
- No -> add to queue
- worker.onmessage, are there more items to work on?
- Yes -> do it
- No -> make worker available
Get the threadpool code here
and use it like this:
_queue.push(stuffForWorker);
But from the pastebin you'll need to change onnmessage
onmessage = function(data){ ...Does something meaningful with your returned data... }
Help me out!
No comments:
Post a Comment