-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
PERF: periodarr_to_dt64arr #35171
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
PERF: periodarr_to_dt64arr #35171
Conversation
jreback
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you comment on the slowdowns on the particular cases, e.g. 4000, 5000, I guess we don't care about these as much
pandas/_libs/tslibs/period.pyx
Outdated
| Py_ssize_t i, l | ||
|
|
||
| l = len(periodarr) | ||
| if freq >= FR_DAY: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a comment here that you are short-circuiting for perf
pandas/_libs/tslibs/period.pyx
Outdated
| return ensure_datetime64ns(dta) | ||
|
|
||
| out = np.empty(l, dtype='i8') | ||
| l = len(periodarr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a comment on which cases this hits
pandas/_libs/tslibs/period.pyx
Outdated
|
|
||
| out = np.empty(l, dtype='i8') | ||
| l = len(periodarr) | ||
| out = np.empty(l, dtype="i8") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be a nogil loop right? (actually couldn't this entire function)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
worth doing this here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this cant be nogil becuase it calls check_dts_bounds, which may raise
As mentioned in the OP, i dont understand why we see slowdowns this big. It should just be one extra |
…rf-periodarr_to_dt64arr
|
i think i might be able to fastpath some more cases, will give that a shot |
|
OK, i think i got these addressed: We still have some cases that see a 2-3x slowdown, but those are now all length-0 or length-1 cases where the actual time difference is tiny (and makes sense) |
|
thanks |
black pandasgit diff upstream/master -u -- "*.py" | flake8 --diffRe-use
ensure_datetime64nsfor the subset of cases where that is applicable. I'm at a loss for why we get such a slowdown for the other cases.