-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN: writers.pyx cdef cleanup #23880
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
Conversation
What factors are you using to determine |
pandas/_libs/writers.pyx
Outdated
ndarray[uint8_t] narr | ||
unsigned char v, comma, left_bracket, right_brack, newline | ||
ndarray[uint8_t, ndim=1] narr | ||
unsigned char v, newline, comma, left_bracket, right_bracket, quote |
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.
LGTM. Only nitpick while we're here: can you change v
to val
just to avoid 1-character names
Codecov Report
@@ Coverage Diff @@
## master #23880 +/- ##
=======================================
Coverage 92.29% 92.29%
=======================================
Files 161 161
Lines 51498 51498
=======================================
Hits 47530 47530
Misses 3968 3968
Continue to review full report at Codecov.
|
To add onto @WillAyd point, |
@WillAyd py_ssize_t is unsigned, is the suggested usage for length-like variables. |
@jbrockmendel it's size_t that is unsigned and Py_ssize_t is signed, no? https://www.python.org/dev/peps/pep-0353/ IIUC helps ensure cross-platform indexing can go beyond 2**31 that compilers may use for an int even on 64 bit platforms. That makes sense to me though I'd just be curious then if there's a reason we would choose this over say a |
The train of thought was, as @jbrockmendel mentioned, to use The pep mentiones No performance regressions when running the asvs:
|
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.
OK by me. Curious if this cleanup can be applied elsewhere in the code base
@@ -23,7 +23,7 @@ ctypedef fused pandas_string: | |||
@cython.boundscheck(False) | |||
@cython.wraparound(False) | |||
def write_csv_rows(list data, ndarray data_index, |
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.
Do we stand to gain anything by being more explicit about the type of the ndarrays 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.
I wasn't able to find a type for these ndarrays that passes the test suite. Should be okay as is.
thanks @mroeschke |
int
toPy_ssize_t