Re:An Introduction to HTML 5 Web Workers
by franze on Monday March 05, 2012 @08:05AM
(#3666365)
i'm currently a little pissed at webwokers (yeah, i take it personally) that i can't hand them a canvaspixelarray. so basically to use workers for canvasimagemanipulation you have to copy the canvaspixelarray into an uint8array, pass it to the work, get back a uint8array and copy that one back into the imagedata.data canvaspixelarray. oh yeah, the copy actions are of course all in the main thread - so this basically defeats the reason to have webworkers in the first place.
Re:An Introduction to HTML 5 Web Workers
by timb on Monday March 05, 2012 @08:54AM
(#3666480)
the newest chrome has support for transferable objects that can be sent directly to a worker without being copied. this works with ArrayBuffer now, not sure if ImageData is transferable yet, but it should be eventually.
Re:An Introduction to HTML 5 Web Workers
by blasterford on Monday March 05, 2012 @06:28AM
(#3666174)
I hope there are simple ways to disable these on browsers.
Can't imagine every tab having a load of workers in the background, ending well.
One of the pleasant things about javascript is that there are no threads. It's a shame some people have pushed for this API.
After all, it's not rocket science for a competent developer to split a long running task into chunks which are periodically run via a timeout, keeping the UI responsive.
Re:An Introduction to HTML 5 Web Workers
by philo23 on Monday March 05, 2012 @07:03AM
(#3666241)
While I agree most things could be split into chunks with a timeout, there's definitely a place for web workers, for example in canvas image processing.
Re:An Introduction to HTML 5 Web Workers
by crymer11 on Monday March 05, 2012 @07:10AM
(#3666254)
I wholeheartedly agree. I had some code that had to parse several different .ply files and creat the respective 3D models, and without web workers, the process was unbearably long.
demo: http://html5-demos.appspot.com/static/workers/transferables/...
Can't imagine every tab having a load of workers in the background, ending well.
One of the pleasant things about javascript is that there are no threads. It's a shame some people have pushed for this API.
After all, it's not rocket science for a competent developer to split a long running task into chunks which are periodically run via a timeout, keeping the UI responsive.