Skip to content

PERF: Improve performance when hashing a nullable extension array #56508

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 3 commits into from
Dec 18, 2023

Conversation

phofl
Copy link
Member

@phofl phofl commented Dec 14, 2023

Avoids the roundtrip through object, this is much faster (around 15x)

@phofl phofl added the Performance Memory or execution speed performance label Dec 14, 2023
@phofl phofl added this to the 2.2 milestone Dec 14, 2023
@@ -1994,7 +1994,7 @@ def _hash_pandas_object(
... hash_key="1000000000000000",
... categorize=False
... )
array([11381023671546835630, 4641644667904626417], dtype=uint64)
array([ 6238072747940578789, 15839785061582574730], dtype=uint64)
Copy link
Member

Choose a reason for hiding this comment

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

Would be good to note that hashing values for masked EA types changed in Other API Changes

Copy link
Member Author

Choose a reason for hiding this comment

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

added

Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

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

lgtm

@rhshadrach rhshadrach added hashing hash_pandas_object NA - MaskedArrays Related to pd.NA and nullable extension arrays labels Dec 18, 2023
@phofl phofl merged commit 7a019bf into pandas-dev:main Dec 18, 2023
@phofl phofl deleted the hash_pandas_object branch December 18, 2023 15:32
cbpygit pushed a commit to cbpygit/pandas that referenced this pull request Jan 2, 2024
…ndas-dev#56508)

* PERF: Improve performance when hashing a nullable extension  array

* Fixup

* Add whatsnew
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hashing hash_pandas_object NA - MaskedArrays Related to pd.NA and nullable extension arrays Performance Memory or execution speed performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants