Closed KristofferC closed 9 months ago
For some reason we did the conversion to static vectors "wholesale" for the whole input matrix instead of just doing it point by point.
julia> using NearestNeighbors julia> tree = KDTree(rand(3, 100)); julia> @time input = rand(3, 10^6); 0.036092 seconds (2 allocations: 22.888 MiB, 89.04% gc time) # Before julia> @time knn(tree, input, 5); 0.368772 seconds (2.00 M allocations: 221.253 MiB, 5.09% gc time) # After julia> @time knn(tree, input, 5); 0.395747 seconds (2.00 M allocations: 198.365 MiB, 17.31% gc time)
We can see we save copying that 20 mb input.
For some reason we did the conversion to static vectors "wholesale" for the whole input matrix instead of just doing it point by point.
We can see we save copying that 20 mb input.