Skip to content

Fix longitudinal plots with a single comparison version. #421

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 2 commits into from

Conversation

Yhg1s
Copy link
Collaborator

@Yhg1s Yhg1s commented Apr 23, 2025

If there's a single subplot, pyplot.subplots's second return value is not an array, so we can't zip() it.

There is at least one hard-coded assumption about the longitudinal plots (specifically, that the third plot is for JIT) but while that's probably a bit confusing if you'd want to have three plots for different versions, at least it appears clearly in the output label. (I've been thinking about ways to make the plotting more configurable, but in the mean time this fixes a bug when you only care about one longitudinal plot.)

Yhg1s added 2 commits April 23, 2025 01:01
… single

subplot, pyplot.subplots's second argument is not an array.
Copy link
Contributor

@mdboom mdboom left a comment

Choose a reason for hiding this comment

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

Ah, maybe copying MATLAB's API 20 years ago wasn't a great idea.

Approved pending the required typing workarounds...

@mdboom mdboom requested a review from Copilot April 23, 2025 13:34
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an issue where a single subplot causes errors due to plt.subplots returning a single Axes instead of a list, ensuring consistent handling of axes for longitudinal plots.

  • Introduces a variable (numvers) to store the number of versions from the configuration
  • Updates figure size calculations and wraps the single Axes into a list for consistent iteration
Comments suppressed due to low confidence (1)

bench_runner/plot.py:263

  • [nitpick] Consider renaming 'numvers' to 'num_versions' for improved clarity.
numvers = len(cfg["versions"])

mdboom added a commit to mdboom/bench_runner that referenced this pull request Apr 24, 2025
This removes all of the hardcoding of corner-cases
in the plotting code.

Fixes faster-cpython#424.  Supercedes faster-cpython#423 and faster-cpython#421.
@mdboom mdboom mentioned this pull request Apr 24, 2025
@mdboom
Copy link
Contributor

mdboom commented Apr 24, 2025

Superceded by #425.

@mdboom mdboom closed this Apr 24, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants