-
Notifications
You must be signed in to change notification settings - Fork 80
PERF: eliminate redundant sorting #793
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
base: main
Are you sure you want to change the base?
Conversation
sorter = sparray.row.argsort(**argsort_kwds) | ||
head = ids[sparray.row][sorter] | ||
tail = ids[sparray.col][sorter] | ||
data = sparray.data[sorter] | ||
head = ids[sparray.row] | ||
tail = ids[sparray.col] | ||
data = sparray.data | ||
else: | ||
sorter = sparray.row.argsort(**argsort_kwds) | ||
head = sparray.row[sorter] | ||
tail = sparray.col[sorter] | ||
data = sparray.data[sorter] | ||
head = sparray.row | ||
tail = sparray.col | ||
data = sparray.data |
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.
Unnecessary as _resolve_islands
does this. And if it does not go through there, it is done in clique resolution.
@@ -1085,7 +1085,7 @@ def build_kernel( | |||
coplanar=coplanar, | |||
) | |||
|
|||
return cls.from_arrays(head, tail, weight) | |||
return cls.from_arrays(head, tail, weight, is_sorted=True) |
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.
As mentioned above, output of _kernel
is known to be sorted.
CI is not failing because of this but because of missing upper pin in numba-feedstock that is being resolved independently by others. |
Within
gwlearn
bandwidth search, we generate quite large graphs and it turned out that the bottleneck is not model fitting but graph creation. Especially sorting and reindex we do, and which we do at multiple spots even though one shall be enough. Removing some obvious redundancies here but there's a likelihood that some other performance-focused PRs will follow.