You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using Mapbox feature state to handle updating a source with a large number of features quickly, I find that there is a significant performance degradation when using the promoteId source feature to use a non-numeric string identifier, such as a UUID. The performance gets worse the more features get updated feature state, and is particularly noticeable when zooming in and out of the features on the map.
If I swap the source to use generateId, the issue goes away, and feature state performs as efficiently as expected. I suspect the same may be the case if the features had their own numeric ids, as well.
mapbox-gl-js version: 3.7.0
browser: Chrome Version 130.0.6723.70
Steps to Trigger Behavior
Create a map with a GeoJSON FeatureCollection source. Create a unique string identifier in the properties field of each Feature in the collection, and use promoteId on the map source to point to that identifier field. The issue is more noticeable with a large quantity of data.
Add a layer with paint properties that depend on feature state.
Add mousemove hover behavior to update that feature state property.
Hover over several different points and attempt to zoom in and out of the map. Observe the choppy behavior.
(bonus) replace promoteId with generateId on the source and repeat step 4. Observe the smooth behavior.
When using Mapbox feature state to handle updating a source with a large number of features quickly, I find that there is a significant performance degradation when using the promoteId source feature to use a non-numeric string identifier, such as a UUID. The performance gets worse the more features get updated feature state, and is particularly noticeable when zooming in and out of the features on the map.
If I swap the source to use
generateId
, the issue goes away, and feature state performs as efficiently as expected. I suspect the same may be the case if the features had their own numeric ids, as well.mapbox-gl-js version: 3.7.0
browser: Chrome Version 130.0.6723.70
Steps to Trigger Behavior
properties
field of each Feature in the collection, and usepromoteId
on the map source to point to that identifier field. The issue is more noticeable with a large quantity of data.mousemove
hover behavior to update that feature state property.promoteId
withgenerateId
on the source and repeat step 4. Observe the smooth behavior.Link to Demonstration
With
promoteId
: https://jsfiddle.net/cLav6hbm/4/With
generateId
: https://jsfiddle.net/cLav6hbm/3/Expected Behavior
Smooth panning and zooming on the map.
Actual Behavior
Choppy panning and zooming on the map.
The text was updated successfully, but these errors were encountered: