Hi!
ClippingPolygonCollection.computeIntersectionWithBoundingVolume causes a massive performance hit in the default sandcastle. Something is wrong with the implementation there. Tested on Windows, Nvidia RTX 4090, framerate is about 10fps and a solid +120fps without the clip!
Re-produce:
There are some performance issues with clipping polygons. This is already tracked in Improve Clipping Polygon Performance · Issue #12258 · CesiumGS/cesium · GitHub , which contains some additional details about the source. (I don’t see computeIntersectionWithBoundingVolume
in the stack trace there, but there are several functions that may be involved here…)
1 Like
Thanks! Thats great info in the ticket about this… I ended up adding a “dirty flag”-style temporary solution:
ClippingPolygon.prototype.computeRectangle = function (result) {
// TODO: Make it possible to edit the polygons.
if (!this._computedRectangle) {
this._computedRectangle = new Rectangle();
PolygonGeometry.computeRectangleFromPositions(
this.positions,
this.ellipsoid,
undefined,
this._computedRectangle,
);
}
const res = defined(result) ? result : new Rectangle();
Rectangle.clone(this._computedRectangle, res);
return res;
};