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

Improve performance of arithmetic on MultiVector pairs #283

Merged
merged 1 commit into from
Mar 12, 2020

Conversation

eric-wieser
Copy link
Member

The previous code was optimized for MultiVector <op> something_else, incurring an expensive isinstance(other, numbers.Number) check.

This changes it to check isinstance(other, MultiVector) first, which is the case that is going to be most frequent.

Extracted from #280, since it's a tiny patch

The previous code was optimized for `MultiVector <op> something_else`, incurring an expensive `isinstance(other, numbers.Number)` check.

This changes it to check `isinstance(other, MultiVector)` first, which is the case that is going to be most frequent.
@codecov
Copy link

codecov bot commented Mar 12, 2020

Codecov Report

Merging #283 into master will increase coverage by 0.08%.
The diff coverage is 60.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #283      +/-   ##
==========================================
+ Coverage   63.06%   63.14%   +0.08%     
==========================================
  Files          50       50              
  Lines        7294     7294              
  Branches     1033     1033              
==========================================
+ Hits         4600     4606       +6     
+ Misses       2545     2540       -5     
+ Partials      149      148       -1     
Impacted Files Coverage Δ
clifford/_multivector.py 81.23% <60.00%> (ø)
clifford/test/test_g3c_tools.py 79.67% <0.00%> (+0.47%) ⬆️
clifford/tools/g3c/model_matching.py 42.77% <0.00%> (+1.20%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a5c9431...d8a8309. Read the comment docs.

@eric-wieser eric-wieser merged commit 36b5963 into pygae:master Mar 12, 2020
@eric-wieser eric-wieser deleted the faster-isinstance branch March 23, 2020 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant