Skip to content

Conversation

jbrockmendel
Copy link
Member

import pandas as pd
import numpy as np

N = 10 ** 5
left = pd.IntervalIndex.from_breaks(np.arange(N))
right = pd.IntervalIndex.from_breaks(np.arange(N - 3, 2 * N - 3))

%timeit left.intersection(right)
146 ms ± 1.82 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)  # <- master
5.6 ms ± 277 µs per loop (mean ± std. dev. of 7 runs, 1 loop each)  # <- PR

We're also going to get a nice bump in join_monotonic/_inner_indexer, but not big enough to warrant not-special-casing IntervalIndex's intersection.

@jreback jreback added this to the 1.3 milestone Jun 28, 2021
@jreback jreback added the Regression Functionality that used to work in a prior pandas version label Jun 28, 2021
@jreback jreback merged commit 569a615 into pandas-dev:master Jun 28, 2021
@lumberbot-app
Copy link

lumberbot-app bot commented Jun 28, 2021

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
$ git checkout 1.3.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 569a615a89fada930cef8de588958bd5b477232c
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #42268: PERF: IntervalIndex.intersection'
  1. Push to a named branch :
git push YOURFORK 1.3.x:auto-backport-of-pr-42268-on-1.3.x
  1. Create a PR against branch 1.3.x, I would have named this PR:

"Backport PR #42268 on branch 1.3.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to suggest an improvement.

@jreback
Copy link
Contributor

jreback commented Jun 28, 2021

@meeseeksdev backport 1.3.x

@lumberbot-app

This comment has been minimized.

@jreback
Copy link
Contributor

jreback commented Jun 28, 2021

@jbrockmendel this failed to backport if you can do manual

cc @simonjayhawkins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PERF: regression in IntervalIndex intersection
3 participants