-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
PERF: Using Numpy C-API when calling np.arange
#32804
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
i usually write a |
if its in a place that gets called a zillion times (especially in a loop), then go for it. For others is probably isn't worth the cognitive overhead for the next reader to come along. |
Okay, make sense.
If a comment is included (like in this PR), does it solves the cognitive overhead? and are the there any other objections? |
I guess, but then it feels fishy to be adding identical comments in many places (then again, I do this too). Your call. Separate topic: in core.groupby.generic L389, L1350, L1702 there are calls to ._convert that I think are superfluous. Getting a second pair of eyes to try to reason about the code and prove it would be great if you're up for it. |
thanks @MomIsBestFriend |
BTW, I don't think we should merge such PRs in the future without a performance check showing an considerable improvement. |
Co-authored-by: MomIsBestFriend <>
Co-authored-by: MomIsBestFriend <>
Co-authored-by: MomIsBestFriend <>
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
Somewhat of a follow up to #32681.
I could not benchmark this change as this function is
cdef
and notdef
orcpdef
(I would also love if someone could give me a tip on how to benchmarkcdef
functions from anIpython
shell for example).What I did what I ran
cython -a pandas/_libs/internals.pyx
and took a screenshot of the before and after.Master:
PR:
Also, is there a reason not to replace every call of
np.arange
withcnp.PyArray_Arange
? (cython files only)