-
Notifications
You must be signed in to change notification settings - Fork 994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider adding bulkAddBegin/bulkAddEnd methods #59
Comments
Or you can just do |
As always you are a genius :-) That sounds so obvious now! I'll bring this in with layer support, so you can add/remove layer groups and it'll add/remove their child markers. |
…esome performance. TODO: Docs+Example. Refs #59
This is implemented with addLayers and removeLayers now. Performance difference of adding markers after adding the MarkerClusterGroup to the map: Adding 10000 markers Removing those 10000 markers: Removing half (5000) of them Removing 100 of them Removing 9000 of them Hrm, these really make removeLayers look bad :( If you are removing lots of layers I definitely recommend clearLayers then addLayers. Will add this to the documentation. |
found this when swapping out clusters and it's really handy. I'm leveraging clearLayers() is there a way to do this that animates out the clusters and allows me to animate in the newly loaded ones? |
Nope sorry. On Wednesday, 17 December 2014, Kyle Bradshaw notifications@github.com
|
Based on @danzel's benchmarks, the optimal cutoff to start using clearLayers would be > 39% of markers getting removed (using exponential interpolation). Would need to do more testing to see if that holds for variable sample sizes, different browsers, and different computers though. But that's probably a good rough number to start with. |
Currently when you call addLayer while the MarkerClusterGroup is on the map it will add/remove/update markers on the map as it goes.
Need to investigate if this is a performance issue, if it is then add some new methods:
bulkAddBegin: Stops addLayer from adding/updating/removing layers on the map
bulkAddEnd: Adds all layers that should be on the map to the map.
This is for the cases where you load 1000s more markers via AJAX later.
The text was updated successfully, but these errors were encountered: