Parallel Processing Simulation in Javascript

Posted by le_havre on Stack Overflow See other posts from Stack Overflow or by le_havre
Published on 2011-02-05T15:10:19Z Indexed on 2011/02/05 15:25 UTC
Read the original article Hit count: 195

Hello,

I'm new to JavaScript so forgive me for being a n00b.

When there's intensive calculation required, it more than likely involves loops that are recursive or otherwise. Sometimes this may mean having am recursive loop that runs four functions and maybe each of those functions walks the entire DOM tree, read positions and do some math for collision detection or whatever.

While the first function is walking the DOM tree, the next one will have to wait its for the first one to finish, and so forth. Instead of doing this, why not launch those loops-within-loops separately, outside the programs, and act on their calculations in another loop that runs slower because it isn't doing those calculations itself?

Retarded or clever?

Thanks in advance!

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about multithreading