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

Trigger explicit warning when out of boundaries only once #95

Merged
merged 3 commits into from
Oct 14, 2022
Merged

Conversation

ojeda-e
Copy link
Member

@ojeda-e ojeda-e commented Oct 13, 2022

Description

As described in #86, the explicit warning messages introduced in #83 significantly affect performance. In this PR I introduced the WarnOnce class in surface.py, which provides an explicit message only once and after that triggers a generic message. It saves time when computing in membrane-protein systems, in particular. Tests were updated with regex that match both patterns.

Status

  • Ready to go

@ojeda-e
Copy link
Member Author

ojeda-e commented Oct 13, 2022

@hmacdope maybe you can help me with a review here, please?

@codecov
Copy link

codecov bot commented Oct 13, 2022

Codecov Report

Merging #95 (8b89f56) into main (ab0d652) will not change coverage.
The diff coverage is 100.00%.

Additional details and impacted files

Copy link
Member

@hmacdope hmacdope left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me @ojeda-e! Just out of curiosity what was the performance difference (roughly)?

@hmacdope
Copy link
Member

@ojeda-e I don't have write access so you can just approve and merge yourself.

@ojeda-e
Copy link
Member Author

ojeda-e commented Oct 14, 2022

Thanks, @hmacdope!

Looks good to me @ojeda-e! Just out of curiosity what was the performance difference (roughly)?

I had a membrane-protein system with a 2500-frame trajectory and ~18900 atoms. Having explicit warning messages takes 57.38 seconds to iterate over the full number of frames, vs. 5.24 with the solution here implemented in WarnOnce. I understand it's just a particular case, but still, it is a significant difference.
This solution saves quite a lot of time with the logger/print operation, which was too expensive with the explicit warning.

@ojeda-e I don't have write access so you can just approve and merge yourself.

Thanks for letting me know, I just added @MDAnalysis/gsoc-mentors as admin in the repo, it gave you write access right away.

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.

2 participants