Skip to content

Perf/ranked knn distances - #64

Draft
tbdlarsen wants to merge 2 commits into
mainfrom
perf/ranked-knn-distances
Draft

tbdlarsen wants to merge 2 commits into
mainfrom
perf/ranked-knn-distances

Conversation

@tbdlarsen

Copy link
Copy Markdown
Contributor

Currently doing run, should cut cache making time in half,
it does so by returning knn and distances when calculated, so we dont have to re-calculate for all queries, i.e., in the j_T checks.

will add symmetry for further speedup, i.e., distance from q1 to q2 is the same as distance from q2 to q1

Kristofferjoha and others added 2 commits November 22, 2026 11:15
add_ranked_neighbours recomputed every neighbour's distance with
frechet_distance: a full discrete Fréchet, then a bisection from 0 in
1 mm steps, about 20 continuous decisions per neighbour. The kNN search
had already computed each distance on the 1 mm ranking grid, usually
with one decision from its Hausdorff bound, and returned only indices.

query::knn_with_distances returns those (index, distance) pairs, and
query::knn now wraps it. The ranked lists use them directly, so their
distances sit on the same grid as the ranking. The ranked cache magic is
bumped, so caches with the old distances are rebuilt.

On the 15 % Geolife sample (seed 42) building the ranked lists takes
327 s instead of 699 s. The lists hold the same neighbours in the same
order, with distances within 1 mm. Runs that load the cache are
unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants