SINTEF-9012 / PruneCluster

Fast and realtime marker clustering for Leaflet
MIT License
551 stars 133 forks source link

Don't use insertionSort when more than 300 markers are added #91

Closed uniphil closed 9 years ago

uniphil commented 9 years ago

Uses the old 20% rule up to 300 markers and then always does the built-in (n log n) sort.

This is a big performance win for large datasets when eg. 19000 new markers could trigger an insertionSort on a 100k dataset.

Measured on a real application: sorting time during app startup dropped from 70seconds(!!) to <200ms.

Both sorts are also now wrapped in the if (_nbChanges) check to avoid redundant sorts (even if they're fast and stable, I think this logic is simpler).

fungiboletus commented 9 years ago

Thanks a lot for the pull-request. I will run some tests and release a new version later this week (I hope).