-
Notifications
You must be signed in to change notification settings - Fork 33
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
Optimize search algorithms #174
Conversation
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.
Getting null reference exceptions from HitObjectManager.GetBeatSnap()
when loading certain SV maps, such as https://quavergame.com/mapset/map/143978.
Fixed. |
The
Qua
has an invariance relating to its collections: It is always sorted byStartTime
. Knowing this, we can use this property to use a binary search implementation instead for its various functions, which is much faster given that hit objects and scroll velocites tends to be in the thousands, if not tens of thousands.We also implementAIComparable<T>
for these instances which allows us to use the defaultList<T>.Sort
instead of having to do.OrderBy().ToList()
. This additionally increases performance by doing in-memory sorting..HybridSort()
function exists to pick the best strategy for anyList<T>
that implementsIStartTime
forT
, which is a hybrid sorting algorithm between insertion sort and quick sort.