perf: Reduce some clustering computation#1383
Conversation
We were needlessly computing clustering for map levels that are unreachable.
|
🎉 This PR is included in version 1.14.7 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
As part of this, I had looked at if it was possible to speed up the distance grid code. The bulk of the time clustering is spent in checking if points are near each other. This is done through a distance grid where a bin is computed for a point by making integer values for its coordinate at the granularity of the merge distance. Then, a data structure of grid[row][column][points] is maintained. grid and grid[row] are objects, but the grid[row][column] entries are list, and the points in that bucket are stepped through. I would have thought that an object would be faster, since slicing and push seem like they should be slower than hash lookups. Similarly, a single level object of grid[ I think any substantial speed up would need to change the point-at-a-time method to some sort of bulk addition. |
We were needlessly computing clustering for map levels that are unreachable.