-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
PERF improve performance of is_lexsorted #47459
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
result = False | ||
break | ||
if not result: | ||
break |
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 makes sense to me. But probably even better instead of the double break, to simply return when we know it's False
. And we don't even need the result
variable, since the return at the end of the function should always be return True
.
result = False | |
break | |
if not result: | |
break | |
free(vecs) | |
return False |
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.
looks like this isn't allowed
Error compiling Cython file:
------------------------------------------------------------
...
else:
result = False
break
if not result:
free(vecs)
return False
^
------------------------------------------------------------
pandas/_libs/algos.pyx:184:16: Returning Python object not allowed without gil
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.
Good to know, I was wondering if there was a Cython limitation. Thanks for trying it.
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. Off to @datapythonista
this diff is showing a lot of changes |
actually this is fine
If
result
is False, there's no need to keep the outer loop going, right?Timing result, with
failure
taken fromtest_is_lexsorted
:More extreme example: