Skip to content

Fix the last-release benchmark workflow failing on StringAccessor.time_center('O') - #11871

Open
glaziermag wants to merge 1 commit into
pydata:mainfrom
glaziermag:fix-time-center-benchmark
Open

glaziermag wants to merge 1 commit into
pydata:mainfrom
glaziermag:fix-time-center-benchmark

Conversation

@glaziermag

Copy link
Copy Markdown
Contributor

Description

The "Benchmark compare last release" workflow has failed on every push to main since #11746 was merged on 10-22 (latest run, first failing run). In the runs I checked, the only failure is accessors.StringAccessor.time_center with the 'O' parameter, and only on the baseline. v2026.09.0 predates #11722, so its str.center raises AttributeError: type object 'numpy.object_' has no attribute 'center' for object arrays. On main the benchmark runs.

This attaches a setup to time_center that raises NotImplementedError when str.center fails for the dtype, as #11699 did for the missing rolling methods. asv then skips the 'O' case on v2026.09.0 and still measures it on main. The next release would also clear this, but until then every run fails, so a real slowdown would not stand out.

To reproduce, run this from asv_bench in an environment with xarray 2026.9.0, asv and the benchmark dependencies:

asv run --python=same --bench StringAccessor.time_center --quick --show-stderr

Without this change it reports time_center 1/3 failed with the traceback above. With it, it reports ok, with n/a for O and asv: skipped: NotImplementedError("str.center doesn't support 'O'").

Checked locally

asv 0.6.6, Python 3.12, numpy 2.3.5:

  • xarray 2026.9.0, twice each: 'O' fails without this change and is skipped with it. The workflow's grep "Traceback \|failed\|PERFORMANCE DECREASED" check matches without the change and finds nothing with it.
  • xarray main (9577645): all three dtypes run with and without the change.

In the six failing runs I checked between 10-22 and 11-09, this benchmark was the only line that check matched. ruff 0.17.3 passes on the changed file.

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.
      Tools: Claude Code (Claude Opus 5.5). It found the failing workflow runs, wrote the change and this description, and ran the checks above.

[This is Claude Code on behalf of glaziermag]

🤖 Generated with Claude Code

The last-release benchmark workflow has failed on every push to main since
pydata#11746 added `StringAccessor`: its baseline v2026.09.0 predates pydata#11722, so
`str.center` raises AttributeError for object arrays there. Raise
NotImplementedError from a setup attached to `time_center` instead, as for the
missing rolling methods in pydata#11699, so asv skips that case on the baseline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@headtr1ck headtr1ck added the plan to merge Final call for comments label Nov 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🧘 No significant changes. Perfectly balanced, as all things should be.

Comparing 265deafa (this PR merged into the base branch) with 6f4a21cf (base branch).
Only changes by more than a factor of 1.5 are shown, see the workflow run for all results.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plan to merge Final call for comments topic-performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants