Closed KristofferC closed 2 months ago
To verify that this is better:
using Revise, StableRNGs
using NearestNeighbors
data = rand(StableRNG(1), 3, 10^4);
x = BallTree(data);
v = rand(StableRNG(1), 3);
using GFlops
@count_ops inrange(x, v, 0.01)
Master:
Flop Counter: 2050 flop
┌──────┬─────────┐
│ │ Float64 │
├──────┼─────────┤
│ add │ 610 │
│ sub │ 640 │
│ mul │ 640 │
│ sqrt │ 160 │
└──────┴─────────┘
PR:
Flop Counter: 1491 flop
┌──────┬─────────┐
│ │ Float64 │
├──────┼─────────┤
│ add │ 438 │
│ sub │ 468 │
│ mul │ 555 │
│ sqrt │ 30 │
└──────┴─────────┘
We can:
encloses
an extra time when searching since we already computed it inintersect
earlier.sqrt
) for some metrics when checking intersections and enclosures by "squaring both sides".Some kind of benchmark: