When a GeoJsonSource uses Animate, startSourceAnimation (runtime.ts) rebuilds the entire document every frame: it allocates a new feature and coordinates array per moving point and calls setData, so MapLibre re-parses everything ~60 times a second. Fine for a few features, stuttery on a large document. TrackedEntityLayer avoids this with binary motion frames; the raw source animate path does not.
We should stop rebuilding the whole document per frame: only touch the features that move, mutate coordinates in place instead of reallocating, and prefer updateData over setData if it is available.
Correctness is already covered (the animated source updates tests check the interpolation). The gap is performance: the benchmark GeoJSON scenarios only run plain setData, so we should add an animated scenario under the existing budgets to catch regressions.
When a
GeoJsonSourceusesAnimate,startSourceAnimation(runtime.ts) rebuilds the entire document every frame: it allocates a new feature and coordinates array per moving point and callssetData, so MapLibre re-parses everything ~60 times a second. Fine for a few features, stuttery on a large document.TrackedEntityLayeravoids this with binary motion frames; the raw source animate path does not.We should stop rebuilding the whole document per frame: only touch the features that move, mutate coordinates in place instead of reallocating, and prefer
updateDataoversetDataif it is available.Correctness is already covered (the
animated source updatestests check the interpolation). The gap is performance: the benchmark GeoJSON scenarios only run plainsetData, so we should add an animated scenario under the existing budgets to catch regressions.