queryRenderedFeatures
gets very slow with complex maps due to O(n^2) layerId lookup in loadMatchingFeature
#4770
Labels
I know exactly how to fix this: we need to pass
layers
as aSet
rather than a list and use.has
instead ofarrayIntersects
andfilterLayerIDs.indexOf(layerID)
.The problem here is that this is likely to alter the signature of some parts of MapLibre that might be considered public. For instance, although this is accessed usually via
map.queryRenderedFeatures
there are other entry points such as via theTile
class.How should I proceed in making a PR here? We could accept either and check if it's an Array or Set all the way down?
maplibre-gl-js version: 4.7
browser: All
Steps to Trigger Behavior
Link to Demonstration
An immense amount of time being spent in
loadMatchingFeatures
Expected Behavior
It shouldn't get quadratically slower as layers are added.
Actual Behavior
It gets quadratically slower as layers are added.
The text was updated successfully, but these errors were encountered: