Skip to content

GeoJsonSource: animated updates rebuild the whole document every frame #156

Description

@igotinfected

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

✨ improvementnew feature or improvement upon existing features

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions