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

Use faster algorithm for generating contours #161

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

paulromano
Copy link
Contributor

The Axes.contour method from matplotlib uses ContourPy under the hood, and there are several algorithms that are available. I noticed that the default one that matplotlib uses ("mpl2014") is a bit older than the default one for ContourPy ("serial"). This PR explicitly uses the "serial" algorithm whenever we call ax.contour, which in my testing results in a 2x speedup for generating contours.

The problem where I noticed this is as shown below. I was looking at a mesh annotation for a 80x80x80 mesh, and generating the mesh annotation took 25 seconds. Switching to the "serial" algorithm cut that down to 13 seconds.

@paulromano paulromano requested a review from pshriwise January 21, 2025 04:15
Copy link
Collaborator

@pshriwise pshriwise left a comment

Choose a reason for hiding this comment

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

Interesting! Thanks for looking into that @paulromano. I tried this and noticed a similar speedup with the change.

@pshriwise pshriwise merged commit 6830777 into openmc-dev:develop Jan 21, 2025
1 check passed
@paulromano paulromano deleted the contour-algorithm branch January 21, 2025 18:18
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.

2 participants