Entities CPU and Memory Performance.

Hi there,
I have a problem that i'm trying to solve a few months =>
performance of static/dynamic polylines in cesium, tried primitives, geometryInstances and more with no solution.

My case is drawing 15,000 that can get updates of material/positions in interval of 5000ms.
But i'm getting CPU crazy picks and memory that shuts my chrome tab,
Here's an example of what i'm trying to do in sandcastle.

Let me know if there's a solution for my case, i already tried every best practice that i found but cannot increase my performance.

Copy and paste it in SandCastle:


var viewer = new Cesium.Viewer('cesiumContainer');

function calcCirclePos(x, y) {
    var positions = [];

    for(var i = 0; i < 30; i++) {
        var currX = x + 2 * Math.cos(2 * Math.PI * i / 30);
        var currY = y + 2 * Math.sin(2 * Math.PI * i / 30);
        positions.push(currX, currY);
    }

    positions.push(positions[0], positions[1]);

    return positions;
}

var entities = [];

viewer.entities.suspendEvents();
for (var lon = -180.0; lon < 180.0; lon += 5.0) {
  for (var lat = -85.0; lat < 85.0; lat += 5.0) {
      var entity = viewer.entities.add({
          polyline : {
              positions : Cesium.Cartesian3.fromDegreesArray(calcCirclePos(lon, lat)),
              width: 1.0,
              material : Cesium.Color.fromRandom({alpha : 1.0})
          }
      });
      
      entities.push(entity);
  }
}

viewer.entities.resumeEvents();

setInterval(function () {
    viewer.entities.suspendEvents();
    entities.forEach(function (entity){
        entity.polyline.material = Cesium.Color.fromRandom({alpha : 1.0});
    });
    viewer.entities.resumeEvents();
}, 8000);

Using last version of Cesium and keeping up upgarding to the last release.
Thank you,
Daniel.

Didn't mention that i was trying to figure it out and saw that when i have amount of alot polylines in entities so when i'm update polylines the CPU intensive spent on cesium update function.

Hi Daniel,

PointPrimitives are going to be a best bet for your performance, see this blog post for a thorough explanation. To get a circle, you should be able to set the point’s outlineColor, and make the fill color totally transparent.

Thanks,

Gabby