Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve asynchronous Primitive creation #1487

Open
1 of 4 tasks
mramato opened this issue Feb 19, 2014 · 4 comments
Open
1 of 4 tasks

Improve asynchronous Primitive creation #1487

mramato opened this issue Feb 19, 2014 · 4 comments

Comments

@mramato
Copy link
Contributor

mramato commented Feb 19, 2014

Update:
While the initial work on this issue is now in master and performance is much better, there are still several things we can do to further improve things. Here are some ideas that we can explore.

  • Creating a general WorkerPool class, basically a threadpool for web workers. I could see this potentially being a singleton used to manage concurrency throughout Cesium (Geometry/Imagery/Terrain/etc..).
  • Rather than pack all data into Float64Arrays, pack data into arrays of the same type. This will require a bit more bookkeeping, but shouldn't be too hard and will require less memory. This will also allow us to use subarray views in unpackInstancesForCombine rather than the overhead of creating lots of typed arrays.
  • The initial call to createGeometry is currently unpacked and can still adds a lot of overhead for certain types of Geometry; this can be fixed by having our Geometry know how to pack themselves or have them store there data in a typed array from the start for each transfer. Pack Geometries before passing to a web worker #2342
  • combineGeometry is still one big synchronous step and is just performed in a worker (rather than split up across several workers like createGeometry). I'm not sure if it's possible to refactor it in a way that allows for concurrency

Original Issue:
Currently, creating primitives asynchronously is much slower than doing it in the main thread. Some simple tests shows that a 1.58 MB GeoJSON file takes about 13 seconds to load asynchronously and only 4 seconds when synchronous. (in Chrome). These numbers are more event dramatic in Firefox, 6 compared to 35.

This is most likely due to a very chatty interface for offloading the pipeline and could be fixed with coarser interfaces.

Here's a profile of what the main thread is doing between "drop 10 megs of GeoJSON on globe" and "stuff shows up" when using asynchronous creation.

image

@mramato mramato added the bug label Feb 19, 2014
mramato added a commit that referenced this issue Feb 19, 2014
Due to #1487.

We can revisit it in the future when performance is better.  Since we create all the geometry up front anyway, this is a load time concern and should not become a usability issue.
@pjcozzi
Copy link
Contributor

pjcozzi commented Feb 19, 2014

👍

It would also be worth exploring how to use multiple workers.

@YouLu
Copy link

YouLu commented Mar 2, 2014

looking forward to it

@mykels
Copy link

mykels commented Jan 9, 2015

Is there a plan to load billboards asynchronously? In our application we implemented a simple algorithm for loading batches of billboards at once (for example 3000) and then waiting for a certain timeout to expire before loading the next batch (for example 1500 ms).

@mramato
Copy link
Contributor Author

mramato commented Jan 10, 2015

@Micha1991, I'm not exactly sure what you are asking. Billboard images are already loaded asynchronously and there's no other part of the process that would cause a block. Please continue this discussion on our forum if you still have questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants