Closed MichaelSchreier closed 5 years ago
Totals | |
---|---|
Change from base Build 61: | 0.08% |
Covered Lines: | 260 |
Relevant Lines: | 272 |
Totals | |
---|---|
Change from base Build 61: | 0.08% |
Covered Lines: | 260 |
Relevant Lines: | 272 |
@MichaelSchreier thanks for the PR! Appreciate the effort, I'll incorporate the changes into a future release. I've updated the PR to merge into dev
instead of master
. Thanks!
numpy.<ufunc>(numpy.ndarray)
withnumpy.ndarray.<ufunc>()
. The latter circumvents a check whether the input is anumpy.ndarray
and is particularly effective for relatively small inputs. But there are still notable time savings even for very large arrays.d
between any two pointsA
andB
must only be computed once rather than asd(A,B)
andd(B,A)
. There are a few extra steps necessary to then fill out the distance and index arrays so the scaling is quite a bit shy of the 50% one might expect at first glance.With the real datasets that I'm working with the first change alone boosts performance by almost 30% and the second one by another 35% for an overall decrease in runtime by about 50%.