I'm using a GoogleMap
with lots of small markers loaded. We are talking perhaps 400-500 markers. Upon user interaction, I want to have a subset of those markers change color, perhaps 100-300 of them. I want to achieve this ideally in 30ms or under, but up to 50-60ms would be acceptable.
Right now I have code something like:
onUserInteraction... {
changeColors(getTheSubset)
}
changeColors(subset) {
getMarkersForSubset(subset).removeAllFromMap();
map.addNewMarkers(subset)
}
So I remove the old markers in some color (say, green), and add new markers for those locations (say, black). When the subset is no longer relevant, I do the opposite process.
On the busiest parts of the map I am seeing this take 500ms or more, and there's noticeable lag with different markers changing colors at different times. So I am curious if there is a better math-based way to draw small circles on a map and change their colors without removing/adding markers and while minimizing alloc/gc.