-
Notifications
You must be signed in to change notification settings - Fork 24
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
Quadratic-time run scanning #8
Comments
Ah, I forgot to change the skipping logic in that commit. If I reject the run I should still skip all those elements, instead of just |
Maybe it would be better to do this filtering in |
Hmm, yes, actually I think that's better in general. |
It seems the patch did not make it into master yet. Any plans to do so? Thanks! |
The minimum run length commit seems to introduce quadratic behavior for runs somewhat shorter than
sqrt(n / 2)
, because the run is repeatedly followed and discarded. If so, this would cause worst-case performance of O(n^(3/2)) by multiplying O(n) time to get past each run by O(sqrt(n)) runs that fit in a length-n array. I took the following timings on a length 1e8 array to confirm that this has a practical impact; the input data is just 0, 1, ... r-1 repeated, for run length r.sqrt(1e8 / 2)
is about 7071; strangely, performance improves gradually from about 6000 to that number instead of sharply as I'd expected. The "% create" here is a loose estimate from perf top of fraction of time spent inLogicalRun<B,T>::create
, and "Time create" is that multiplied by total time.The text was updated successfully, but these errors were encountered: