Repository navigation
Fix StackOverflowError in HotPixelIndex - #605
Conversation
Add nested CoordinateShuffler class and wire it `add(Coordinate[] pts)` in order to get a more balanced KdTree. The insertion speed greatly improves! Signed-off-by: Felix Obermaier <felix.obermaier@netcologne.de>
|
Nice fix, @FObermaier ! I was starting to think about this myself, but this is a very elegant implementation. And it provides a dramatic performance boost. |
|
I wonder if it would be even better to skip shuffling if there are only a small number of points (say <= 100) ? |
|
Or another idea: instead of randomly shuffling the array indices, step through the coordinate array with a stride length which is coprime to the array size. That will visit every array entry once, but in a jumbled order. This may not make a big peformance difference, but will use less memory. The trick is finding a stride length which is relatively prime. One way to do it is given here (and a Java implementation of GCD here) |
|
Further testing indicates that:
Based on this, I'll leave this approach as it is. |
Add nested CoordinateShuffler class and wire it
add(Coordinate[] pts)in order to get a more balanced KdTree. The insertion speed for geometries with many coordinates greatly improves!relates to #602
Signed-off-by: Felix Obermaier felix.obermaier@netcologne.de