Skip to content

PERF: faster numeric indexes comparisons when self is identical to other #37569

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

topper-123
Copy link
Contributor

@topper-123 topper-123 commented Nov 1, 2020

Further performance improvement over #37130, this time improving all numeric indexes. The improvement is larger for Int64Index, because that doesn't need to check for na values.

Examples:

>>> n = 100_000
>>> idx1 = pd.Int64Index(range(n))
>>> idx2 = idx1.view()
>>> %timeit idx1 == idx2
145 µs ± 2.43 µs per loop  # master
11.4 µs ± 290 ns per loop  # this PR
>>> idx3 = pd.Float64Index(range(n))
>>> idx4 = idx3.view()
>>> %timeit idx3 == idx4
104 µs ± 2.12 µs per loop  # master
49.8 µs ± 886 ns per loop  # this PR

@topper-123 topper-123 changed the title PERF: faster numeric indexes comparisons when identical to other PERF: faster numeric indexes comparisons when self is identical to other Nov 1, 2020
@jreback jreback added Index Related to the Index class or subclasses Performance Memory or execution speed performance labels Nov 2, 2020
@jreback jreback added this to the 1.2 milestone Nov 2, 2020
@jreback jreback merged commit db8bae8 into pandas-dev:master Nov 2, 2020
@jreback
Copy link
Contributor

jreback commented Nov 2, 2020

thanks @topper-123

kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
ukarroum pushed a commit to ukarroum/pandas that referenced this pull request Nov 2, 2020
@topper-123 topper-123 deleted the NumericIndex._cmp_method_perf branch January 1, 2021 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Index Related to the Index class or subclasses Performance Memory or execution speed performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants