Another day, another Paul Rouget HTML 5 demo 🙂 This time he does something fun with Web Workers to allow you to see the difference that you can get when you use them.
If you run the demo demo and watch the animated PNG you will see how smooth the world is based on if the animation stops from time to time. Try it with workers on and off to see.
We have been using Workers in Bespin from the get go. Malte Ubl is doing very cool work to ironout the differences between different Web Worker implementations (Firefox, Safari, and Gears). For example, through his abstraction you get the standard
importScripts in Gears too, and it includes a mutex abstraction to boot. This has been crucial for us as we add more JS intensive features to the code editor such as realtime syntax checking, rich syntax highlighting, JSLint error reports inline, and more.
We have found that you do have to be careful with Workers though. You don’t want to fire too many off as you end up with a raging CPU if you aren’t careful, so Malte and others are working on a slicing plan that will keep the CPU down but also keep the UI responsive. We will report back.