GitHub Action to Comparatively Benchmark PRs #3889
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description Of Changes
With the introduction of benchmarking into MetPy, the next step is to incorporate a GitHub action that will benchmark PR's into MetPy's main branch alongside the current performance to make sure merges will not negatively impact the performance of MetPy. To do so, I've added


.github/workflows/benchmark-pr.yml, which is a GitHub workflow that uses asv to comparatively benchmark PR's that are labeled with the labelbenchmarkand fails if any benchmark is 10% or more slower than the current main branch's performance. This check takes ~10 minutes, which is why only labeled PRs will be benchmarked so that those that do not change the calc module can be merged more quickly.In order to test the action, I used my fork https://github.com/blue-jaye-121/MetPy and opened two pull requests onto this feature branch. The first, blue-jaye-121#3, is not expected to fail. This branch is identical to the feature branch except for a new fakechange.txt file which is empty. As you can see from the results,
By contrast, blue-jaye-121#4 is identical to the feature branch except for a sleep function on the


scale_height()function. As you can see, this check fails:since the
scale_height()function is over 600% slower.Checklist