-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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: maybe_convert_numeric speedup #16104
PERF: maybe_convert_numeric speedup #16104
Conversation
pandas/_libs/src/inference.pyx
Outdated
uints[i] = as_int | ||
if as_int <= iINT64_MAX: | ||
ints[i] = as_int | ||
if val >= 0: |
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.
you might be able to
cdef ival <int> val
if ival >= 0:
...
if ival <= iINT64_max:
..
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.
I can't do exactly this because val could be larger than fits into a c
int
the other thing is it might be worth it to actually try to cast once you have found an actual int (or a uint),
At this point it would raise if you encounter a float so this is ok (you can do it in a try/except). not sure if this is totally feasible though. |
OK, I've added some fastpath logic that will try and convert the whole array at once - have to see if anything breaks! |
This should go in 0.20, correct? |
I need to work through a couple more tests, but assuming I can get this to
work in a non-breaking way, yes I'd think this would be good for 0.20.
`to_numeric` performance with ints has regressed quite a bit since 0.19.1
(although is more functional now, to be fair)
…On Mon, Apr 24, 2017 at 10:07 AM, Tom Augspurger ***@***.***> wrote:
This should go in 0.20, correct?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#16104 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB1b_BJWgLonT_hQzRK2-WCm3Rn7XDdOks5rzLqbgaJpZM4NFkMz>
.
|
Codecov Report
@@ Coverage Diff @@
## master #16104 +/- ##
==========================================
- Coverage 90.84% 90.84% -0.01%
==========================================
Files 159 159
Lines 50775 50768 -7
==========================================
- Hits 46126 46118 -8
- Misses 4649 4650 +1
Continue to review full report at Codecov.
|
nice! thanks @chris-b1 |
Yeah, I put the 0.21 milestone on it as it was about performance, but forgot it was for a perf regressiono in 0.20dev. So certainly fine. Thanks Chris! |
xref #16043
Probably more to be done, but picks up some easy performance on the int path. For some reason I'm having trouble running asv, here are some timings.
setup
Master
PR