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.