Skip to content

Add ASV benchmark for Contacts analysis#5291

Open
Amarendra22 wants to merge 8 commits intoMDAnalysis:developfrom
Amarendra22:benchmark-contacts
Open

Add ASV benchmark for Contacts analysis#5291
Amarendra22 wants to merge 8 commits intoMDAnalysis:developfrom
Amarendra22:benchmark-contacts

Conversation

@Amarendra22
Copy link

@Amarendra22 Amarendra22 commented Mar 8, 2026

Summary

This PR adds an ASV benchmark for the Contacts analysis module.

The benchmark measures the runtime of Contacts.run() using the PSF/DCD dataset from MDAnalysisTests. This allows tracking
performance changes in the native contacts analysis workflow across MDAnalysis versions.

Benchmark Added

analysis.contacts.ContactsBench.time_contacts_run

Motivation

The Contacts analysis is commonly used to calculate native contacts in molecular dynamics trajectories. Adding a benchmark
helps detect performance regressions and measure improvements in future optimizations.

LLM / AI generated code disclosure

LLMs or other AI-powered tools were used in this contribution: No

1

📚 Documentation preview 📚: https://mdanalysis--5291.org.readthedocs.build/en/5291/

@codecov
Copy link

codecov bot commented Mar 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.82%. Comparing base (50dc512) to head (b1f3e3e).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5291   +/-   ##
========================================
  Coverage    93.82%   93.82%           
========================================
  Files          182      182           
  Lines        22487    22487           
  Branches      3196     3196           
========================================
  Hits         21099    21099           
  Misses         925      925           
  Partials       463      463           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

Looks pretty good already. Please

  • format with black
  • add yourself to the end of AUTHORS (if you're not already in there)
  • add an entry to CHANGELOG under Enhancements (see other examples of benchmarks)

EDIT: please also vary method='hard_cut' | 'soft_cut' | 'radius_cut' and pbc=True | False.

@orbeckst orbeckst self-assigned this Mar 10, 2026
@orbeckst
Copy link
Member

@Amarendra22 I've seen at least one other PR of yours. I encourage you to focus on one PR and try to get that merged. For MDAnalysis as a project it's much more important to get some work done well then all work started and never finished.

@Amarendra22
Copy link
Author

I am sorry for the delayed response, I was occupied with some other work over the past few days. I have implemented the requested changes:

  • format with black
  • add yourself to the end of AUTHORS (if you're not already in there)
  • add an entry to CHANGELOG under Enhancements (see other examples of benchmarks)
  • vary method='hard_cut' | 'soft_cut' | 'radius_cut' and pbc=True | False

Please let me know if anything else should be improved.

@Amarendra22 Amarendra22 requested a review from orbeckst March 13, 2026 07:33
Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

Thank you for addressing my changes. However, the PR contains changes unrelated to ContactAnalysis benchmarks that should be removed — these belong into a separate PR.

Please also address the comments. Thanks.

@Amarendra22
Copy link
Author

Thank you for the review and for pointing this out.
I have removed the unrelated changes so that the PR only contains the Contacts ASV benchmark along with the corresponding updates to AUTHORS and CHANGELOG. I have also addressed the remaining comments.

Please let me know if any further adjustments are needed.

@Amarendra22 Amarendra22 requested a review from orbeckst March 13, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants