Skip to content

PERF: avoid exceptions in string.Construction benchmark setup #52176

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

Merged

Conversation

ngoldbaum
Copy link
Contributor

#37371 added some new benchmarks, along with some new setup code for the new benchmarks. Unfortunately, the new setup code introduced an uncaught exception:

>>> import pandas._testing as tm
>>> from pandas import Categorical
>>> series_arr = tm.rands_array(nchars=10, size=10**5)
>>> frame_arr = series_arr.reshape((50_000, 2)).copy()
>>> frame_cat_arr = Categorical(frame_arr)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/nathan/Documents/pandas/pandas/core/arrays/categorical.py", line 399, in __init__
    raise NotImplementedError(
NotImplementedError: > 1 ndim Categorical are not supported at this time

This caused asv to skip all the string construction benchmarks since that PR was merged because the setup had an uncaught exception. See e.g. this benchmark report.

The fix is just to remove the broken benchmarks.

I built a version of pandas from just after #37371 was merged and verified that the benchmark was broken then. I can't easily verify that the benchmark has been broken the entire time since then but I strongly suspect that's the case.

@mroeschke mroeschke added the Benchmark Performance (ASV) benchmarks label Mar 24, 2023
@mroeschke mroeschke added this to the 2.1 milestone Mar 24, 2023
Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

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

Nice catch! I think ASV will skip benchmarks if the setup raised a NotImplementedError

@mroeschke mroeschke merged commit ab76365 into pandas-dev:main Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Benchmark Performance (ASV) benchmarks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants