Viewer stutter during entity updates

I have a viewer with many spacecraft (Point & Path packet), and want to stream additional position data from a python backend using Server Side Events (SSE). It works okay, but the viewer freezes momentarily when the new data is processed, so I’m hoping there’s a better way? The current code looks like this:

// load the initial scenario
var czmlData = Cesium.CzmlDataSource.load("data/3d-view.json");
czmlData.then(function (dataSource) {

// update enity postiion with SSE messages
czmlData.then(function(dataSource) {
  const eventSource = new EventSource('/sse');

  eventSource.onmessage = function(event) {
    const data = JSON.parse(;

    // Iterate objs in the received data (key:id, val: list of samples)
    Object.keys(data).forEach(entityId => {
      const entity = dataSource.entities.getById(entityId);
      const entityData = data[entityId];

      entityData.forEach(positionStr => {

        // Parse the position string, convert coords to float
        let [time, x, y, z] = positionStr.split(',');
        [x, y, z] = [x, y, z].map(parseFloat);

        // update entity
          new Cesium.JulianDate.fromIso8601(time),
          new Cesium.Cartesian3(x,y,z)


I’ve tried putting the eventSource.onmessage function inside a web worker, but wasn’t able to transfer any kind of CesiumJS object (like the entity) between the main thread and the worker, only primitive data types which doesn’t help much. Most of the delay comes from the addSample call it seems. Any suggestons would be appreceated - thanks!