-
Notifications
You must be signed in to change notification settings - Fork 663
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
Refactor make_downshift_arrays and enhance the performance of topology construction #3724
Refactor make_downshift_arrays and enhance the performance of topology construction #3724
Conversation
Hello @yuxuanzhuang! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2022-07-25 08:23:04 UTC |
Codecov Report
@@ Coverage Diff @@
## develop #3724 +/- ##
===========================================
- Coverage 94.31% 94.30% -0.02%
===========================================
Files 192 192
Lines 24757 24713 -44
Branches 3340 3328 -12
===========================================
- Hits 23350 23306 -44
Misses 1359 1359
Partials 48 48
Continue to review full report at Codecov.
|
Performance Improvement from MDAnalysis.tests.datafiles import PDB
import MDAnalysis as mda
from MDAnalysis.core.topology import (
TransTable,
make_downshift_arrays,
)
u = mda.Universe(PDB)
n_atoms = u._topology.tt.n_atoms
# 47681 atoms
n_residues = u._topology.tt.n_residues
# 11302 residues
n_segments = u._topology.tt.n_segments
# 1 segment
AR = u._topology.tt._AR
RS = u._topology.tt._RS
%timeit make_downshift_arrays(AR, n_residues)
# original
29.6 ms ± 254 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
# now
12.1 ms ± 73.9 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
%timeit TransTable(n_atoms, n_residues, n_segments, AR, RS)
# original
29.8 ms ± 329 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
# now
17 µs ± 57.4 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)
tt = TransTable(n_atoms, n_residues, n_segments, AR, RS)
%timeit pickle.loads(pickle.dumps(tt))
# original
29.6 ms ± 1.27 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
# now
69.7 µs ± 740 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @yuxuanzhuang , this looks great
@richardjgowers this is approved but unmerged, is it good to go? |
@richardjgowers I assigned the PR to you — please merge if all is good. Thanks! |
Fixes #3721
Changes made in this Pull Request:
Universe._topology.tt. _RA, _SR
during construction and serialization.PR Checklist