Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various performance enhancements #30

Merged
merged 7 commits into from
Apr 6, 2019
Merged

Conversation

MichaelSchreier
Copy link
Contributor

  • Replaced calls to numpy.<ufunc>(numpy.ndarray) with numpy.ndarray.<ufunc>(). The latter circumvents a check whether the input is a numpy.ndarray and is particularly effective for relatively small inputs. But there are still notable time savings even for very large arrays.
  • Replaced itertools.permutations with itertools.combinations as the distance d between any two points A and B must only be computed once rather than as d(A,B) and d(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%.

vc1492a and others added 7 commits January 3, 2019 08:31
…>() where possible for greater performance

-replaced itertools.permutations with itertools.combinations as the distance between any two points A and B must only be computed once rather than as d(A,B) _and_ d(B,A)
@coveralls
Copy link

coveralls commented Apr 5, 2019

Pull Request Test Coverage Report for Build 62

  • 13 of 13 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.08%) to 95.588%

Totals Coverage Status
Change from base Build 61: 0.08%
Covered Lines: 260
Relevant Lines: 272

💛 - Coveralls

1 similar comment
@coveralls
Copy link

Pull Request Test Coverage Report for Build 62

  • 13 of 13 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.08%) to 95.588%

Totals Coverage Status
Change from base Build 61: 0.08%
Covered Lines: 260
Relevant Lines: 272

💛 - Coveralls

@vc1492a vc1492a added the enhancement New feature of request label Apr 5, 2019
@vc1492a
Copy link
Owner

vc1492a commented Apr 5, 2019

@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!

@vc1492a vc1492a changed the base branch from master to dev April 5, 2019 20:50
@vc1492a vc1492a added this to the 0.2.7 milestone Apr 5, 2019
@vc1492a vc1492a merged commit 46eeb79 into vc1492a:dev Apr 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature of request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants