-
Notifications
You must be signed in to change notification settings - Fork 763
Improve speed of GROMOS11 reader #5080
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
Conversation
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.
Hello there first time contributor! Welcome to the MDAnalysis community! We ask that all contributors abide by our Code of Conduct and that first time contributors introduce themselves on GitHub Discussions so we can get to know you. You can learn more about participating here. Please also add yourself to package/AUTHORS as part of this PR.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #5080 +/- ##
========================================
Coverage 93.62% 93.63%
========================================
Files 177 177
Lines 22001 22033 +32
Branches 3114 3115 +1
========================================
+ Hits 20599 20631 +32
- Misses 947 948 +1
+ Partials 455 454 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Looks really good! Thank you for your contribution. Great work.
I only have a few optional comments. If you want to address them, please let us know how much time you need. If you don't want to address them please say so, too, and then we can merge right away.
EDIT: Please run black over TRC.py and check all the other files that you touched. We won't merge until the linter is also happy.
|
Thank you for the valuable feedback @orbeckst ! I implemented the requested changes where possible (see comments). The linters also seem happy now. From my side this should be ready to merge. |
|
Thank you @schuhmc , very nice contribution! 🎉 |
Fixes #5079
The GROMOS11 trajectory reader written by @JoStoe was merged in #4292 (see issue #4291 )
The performance in the current state is very slow
Changes made in this Pull Request:
All-in-all this provides a significant speed boost. Internal testing showed the following speed increase when loading and iterating over a 1 GB trajectory of 2000 frames:
Before these changes: 86.97 s +/- 1.13 s (n=10)
With changes in this PR: 42.05 s +/- 0.66 s (n=10)
Speed improvement -51.6%
On the newly added benchmark the following speed improvement was measured:
traj_reader.TrajReaderCreation.time_reads: 5.339 ms -> 3.579 ms (-33.0%)
traj_reader.TrajReaderIteration.time_strides: 7.642 ms -> 4.524 ms (-40.8%)
(Note that the benchmark trajectories are very small which reduces the impact on the TrajReaderCreation.time_reads benchmark. Based on testing on larger trajectories, the time for the Universe creation is reduced by 70-80% if the file has consistent block sizes)
Most of the speed improvement comes from the skipping over the POSITIONRED block, meaning that it is not necessary to read the full trajectory upon universe creation.
However, note that when the size of the POSITIONRED block is not consistent (whitespace), the speed is impacted.
PR Checklist
package/CHANGELOGfile updated?package/AUTHORS? (If it is not, add it!)I don't think that the documentation needs to be updated.
Developers Certificate of Origin
I certify that I can submit this code contribution as described in the Developer Certificate of Origin, under the MDAnalysis LICENSE.
📚 Documentation preview 📚: https://mdanalysis--5080.org.readthedocs.build/en/5080/