• Post Reply Bookmark Topic Watch Topic
  • New Topic

Web Workers  RSS feed

 
Sunderam Goplalan
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob,

I've heard web workers in HTML 5 does something similar to Threads in Java or another programming language. Where or what kind of real world scenarios can benefit from Web Workers?

Thanks!
G Sunderam
 
Rob Crowther
author
Ranch Hand
Posts: 297
5
Android Fedora Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any time when you need to do processing in JavaScript that would last for a noticeable amount of time (ie. greater than 1/10th second) but not require access to the DOM (WebWorkers do not have access to window or document). WebWorkers communicate back to the parent web page through a message passing mechanism so it is easy to swamp any performance gains made through background processing in copying data between the two threads if you have a large dataset, however WebWorkers do have access to Ajax so if you wanted to request a large block of data from a server, do some complex processing and then deliver a relatively small result set to the page that would be an ideal scenario for them. There are some code examples in the spec which you may find helpful.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!