We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This would speed up F.sort() calls when factors are sorted in the dataset; particularly useful if we run this method a lot (e.g. reghdfe)
First, create .is_sorted
.is_sorted
Then, intercept this loop and replace (not tested):
p[index[level] = index[level] + 1] = obs
with
p[idx = index[level] = index[level] + 1] = obs if (is_sorted) { if (idx < last_idx)) is_sorted = 0 // set is_sorted = 1 before the loop last_idx = idx // initially set last_idx = 0 }
Also benchmark it to see if the slowdown is high (in which case we make the sort check optional and unroll the loop)
Finally, sort() and _sort() should add a line like if (is_sorted) return(data)
sort()
_sort()
if (is_sorted) return(data)
The text was updated successfully, but these errors were encountered:
Impleent #4
fc3f6a7
Note that instead of testing if the data is sorted, we ask Stata for the "sortedby" value. This should work with most of the relevant cases
No branches or pull requests
This would speed up F.sort() calls when factors are sorted in the dataset; particularly useful if we run this method a lot (e.g. reghdfe)
First, create
.is_sorted
Then, intercept this loop and replace (not tested):
with
Also benchmark it to see if the slowdown is high (in which case we make the sort check optional and unroll the loop)
Finally,
sort()
and_sort()
should add a line likeif (is_sorted) return(data)
The text was updated successfully, but these errors were encountered: