Skip to content
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

Merged
merged 27 commits into from
Aug 27, 2024
Merged

Conversation

Emik03
Copy link
Member

@Emik03 Emik03 commented Jul 26, 2024

The Qua has an invariance relating to its collections: It is always sorted by StartTime. 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 implement IComparable<T> for these instances which allows us to use the default List<T>.Sort instead of having to do .OrderBy().ToList(). This additionally increases performance by doing in-memory sorting. A .HybridSort() function exists to pick the best strategy for any List<T> that implements IStartTime for T, which is a hybrid sorting algorithm between insertion sort and quick sort.

@Emik03 Emik03 marked this pull request as draft July 29, 2024 22:00
@Emik03 Emik03 marked this pull request as ready for review July 30, 2024 03:34
Copy link
Member

@Illuminati-CRAZ Illuminati-CRAZ left a 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.

@Emik03
Copy link
Member Author

Emik03 commented Aug 27, 2024

Getting null reference exceptions from HitObjectManager.GetBeatSnap() when loading certain SV maps, such as https://quavergame.com/mapset/map/143978.

Fixed.

@Illuminati-CRAZ Illuminati-CRAZ merged commit 08b4345 into Quaver:master Aug 27, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants