sdd / kiddo

Kiddo
Apache License 2.0
87 stars 14 forks source link

perf: refactor within to simply sort the result of within_unsorted #74

Closed sdd closed 1 year ago

sdd commented 1 year ago

Previously, within was keeping its results in a BinaryHeap and calling its into_sorted_vec method to, well, return a sorted Vec. Whilst a BinaryHeap is great if you are frequently adding and removing items, if your use case is to gradually add all your items, and then sort them all at once, its quicker to just put things in a Vec and then sort the Vec at the end.

codecov-commenter commented 1 year ago

Codecov Report

Merging #74 (20bc719) into next (e6b4c9c) will increase coverage by 2.78%. The diff coverage is 99.48%.

@@            Coverage Diff             @@
##             next      #74      +/-   ##
==========================================
+ Coverage   86.29%   89.08%   +2.78%     
==========================================
  Files          32       32              
  Lines        3882     3958      +76     
==========================================
+ Hits         3350     3526     +176     
+ Misses        532      432     -100     
Impacted Files Coverage Δ
src/fixed/distance.rs 53.57% <ø> (ø)
src/fixed/query/within.rs 99.10% <ø> (-0.90%) :arrow_down:
src/fixed/query/within_unsorted_iter.rs 80.14% <0.00%> (ø)
src/float/distance.rs 100.00% <ø> (ø)
src/float/query/best_n_within.rs 93.75% <ø> (ø)
src/float/query/nearest_n.rs 94.11% <ø> (ø)
src/float/query/nearest_one.rs 92.38% <ø> (ø)
src/float/query/within.rs 100.00% <ø> (+5.26%) :arrow_up:
src/float/query/within_unsorted.rs 94.30% <ø> (ø)
src/float/query/within_unsorted_iter.rs 93.10% <ø> (ø)
... and 3 more

... and 2 files with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more