AnalyticalGraphicsInc/cesium — pull request #1560 by mramato (2014-03-19 01:40:41+00:00)
Title: Streamline geometry web worker usage

This is a first pass at #1487. There is still a ton of room for improvement but asynchronous primitive processing is now slightly faster than synchronous processing when handling large data sets.

1. Primitives now share a global pool of threads (can be configured by user, defaults to 4) and will split geometry creation across those threads.
2. The individual geometry workers are now subTasks of a larger worker, which cuts down on some of the overhead of passing data back and forth. The workers are also much simpler which may cause minor improvements in both build speed and combined worker javascript size. (this PR is a net decrease in code and `ant combine` went from 110 seconds to 100 seconds on my SSD machine).

The overhead of copying rather than transferring objects is still killing us, since we round trip to the main thread between create/combine steps. The amount of garbage we are generating is also a problem. I plan on continuing to look into these, but this first step was clean enough to do on it's own.

I also think there is a ton of room for improvement in the geometry processing itself, whether synchronous or asynchronous, so I may open a PR for that as well.

CZML is still synchronous, because we need some render loop changes before we can turn asynchronous on, we'll do that soon as well.