sorting took ~26% of total time for 1M points example. One of the reasons was that callback was calculating distances on each iteration of sorting algorithm.
This change simply caches distances upfront and combines them with indices of points, reducing sort to just ~12% of total time and improving overall performance by 8-10%.
sorting took ~26% of total time for 1M points example. One of the reasons was that callback was calculating distances on each iteration of sorting algorithm.
This change simply caches distances upfront and combines them with indices of points, reducing sort to just ~12% of total time and improving overall performance by 8-10%.