slow initial rendering of polyline / polygon

We have another project that uses Cesium and it takes our (slow) system ~20 seconds to display our first polygon or polyline. Subsequent polys will display immediately. Is there anything we’re doing wrong? Can we do anything to avoid the lag in displaying the first poly?

I am attaching a basic sandcastle where you can see the problem if you run with an empty browser cache (cached images & files).

Any tips are appreciated. Thanks!

We are Windows 10, Chrome 80, i7 7820, NVIDIAQuadro P3000, 16GB RAM.

https://sandcastle.cesium.com/#c=lVRtb9pADP4rJ74QJHa8FWg7ilZotS9MVIxWmpZpchIDpzp30d0Fyqb+910ClKTtNGZFUezHdvw852QNmv1cC9ygZldM4oaN0Yg05g95zKuGuTtW0oKQqKu1j7705b6Eo7TCCjQcosj77UvmTEKM7JJVZxixRNF2qSRzl0n1AkKs1ndZB+SS7csyWwnUoMPV1oX3c4xBW/cEssMXWsU3uNSI5lpr2HrfP7RaXd6ss07f3Y9tMnuB2u9AzX4Odd6D2jnU+jvk2v6oFcAYLGoBVJhZkdJ8dnuzS3r25XMm26mikRO6KFPml3VKlHEdlDSn6tTvZoO/YdTOwyU2GxHZlWvbPY1hISskiJO5+qxVKiOXugAyeLoCB07/ouQ5MrzVO2v1en03/QW/6LYzO5AgCJDKcll8spm4dytBECElKwHV8mS+JLQsEXKUCopefwx3L3Hv9P0fEchHFlCKWd/jgf4PzX6z3+7tWLab547xgWUgiAIFOiozFTEss5cfieQ98+Pyymc3/XY9GU3ub+vs7LzGrboBC/eziVdchjVqK0KgqRZLURj5oRTno+l8Pv1SFrRSrwyM3RIOd/FPIk6UtizV5HHesBgn5NbKNII0fETLQ2OyskHjUDSIxJqJ6MqvvPoF+ZVs1YxxyCIl+ip+oV8ZDhouv1RGCiIhl1NHgmCbpaxaw8kuyDkfNJz7tsoqRQHoQsc/

Here is a video clip from out actual app:

https://www.youtube.com/watch?v=z_mxQsxTGgk

This is happening because there’s an initial overhead of loading the web workers used to compute the geometry asynchronously.

You could potentially work around this by using the Primitive API which allows you to create geometry synchronously, at the cost of some camera jitters while geometry is loading.

Is there any way to have the web workers load early like upon initialization of Cesium?

We were using Entity API because we needed to do lots of updates to our data and didn’t want to deal with always deleting/recreating things using the Primitives.

Is there any way to have the web workers load early like upon initialization of Cesium?

Did you discover a way to load the web workers Omar mentioned when Cesium is initialized?

We’re having the same problem. The first time a polyline is drawn there is often a very significant delay (10 or more seconds) before the line becomes visible. Subsequent lines are drawn instantaneously.

I never found a good way around it. Switching to use Cesium Primitives instead of the Entity API is one solution. Other than that, we still have widgets that take 20-30sec to draw the first polygon.

We are having the same issue here. Is there a way to load web workers earlier?

Jumping on this thread as well. I’ve been exploring this issue in the Sandcastle and seeing that the first render after adding entities is slow and causes a freeze (easily visible if camera is moving).
It would be nice if we were able to pre-load web workers on Viewer init.

Cesium 1.110 or later has inlined web workers which basically fixes this issue for the scenarios we encounter.
See Inline workers into Cesium.js by ggetz · Pull Request #11519 · CesiumGS/cesium · GitHub

Thanks for pointing out that web workers have been inlined.
That makes it stranger that I’m still seeing an extended stutter/freeze in my Sandcastle, which is running on v1.116.
I went looking for the cause in Chrome’s Memory profile list and found that only 2 “JavaScript VM instances” populate the list by default, but once I draw some entities (and cause a slight freeze), an additional 6 options populate the list.
image

I’m not certain what this indicates, but to me it means Cesium is allocating more resources as needed (I assumed web workers) and this is likely the cause of or related to the freeze I’m seeing.
Note that removing the entities and drawing again is much better; it still stutters, but much less.