Skip to content

REF: remove unnecessary Block specialization #54568

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
merged 5 commits into from
Aug 16, 2023

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

Broken off from a PR implementing optional 2D support for EAs. I can't detect any performance difference locally, want to get this in and check the asvs in a few days.

@jbrockmendel jbrockmendel requested a review from WillAyd as a code owner August 15, 2023 22:01
"""
Defining __init__ in a cython class significantly improves performance.
"""
cdef:
public BlockPlacement _mgr_locs
public BlockValuesRefs refs
readonly int ndim
# 2023-08-15 no apparent performance improvement from declaring values
Copy link
Member

Choose a reason for hiding this comment

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

I'm guessing this would make a difference if we actually had to use attributes of the ndarray that would be access via C instead of via Python, but yea that doesn't look to actually occur in the classes you've removed

@mroeschke
Copy link
Member

mypy (stubtest)..........................................................Failed
- hook id: mypy
- duration: 73.79s
- exit code: 1

/home/runner/work/pandas/pandas/scripts/run_stubtest.py:24: UserWarning: stubtest may fail as 2.1.0rc0+22.gd7b43a57b6 is not a dev version. Please install a pandas dev version or see https://pandas.pydata.org/pandas-docs/stable/development/contributing_codebase.html#validating-type-hints on how to skip the stubtest
  warnings.warn(
pandas._libs.internals.NDArrayBackedBlock is not present at runtime
pandas._libs.internals.NumpyBlock is not present at runtime
pandas._libs.internals.SharedBlock is not present at runtime

@mroeschke mroeschke added the Internals Related to non-user accessible pandas implementation label Aug 16, 2023
@jbrockmendel
Copy link
Member Author

mypy complaints fixed + green

@mroeschke mroeschke added this to the 2.2 milestone Aug 16, 2023
@mroeschke mroeschke merged commit 786716a into pandas-dev:main Aug 16, 2023
@mroeschke
Copy link
Member

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the enh-supports-2d branch August 16, 2023 21:55
mroeschke pushed a commit to mroeschke/pandas that referenced this pull request Aug 18, 2023
* REF: remove unnecessary Block specialization

* revert accidental

* mypy fixup

* mypy fixup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Internals Related to non-user accessible pandas implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants