Skip to content

Faster OGL sprite sorting algorithm

Hannu Hanhi requested to merge Hannu_Hanhi/SRB2:ogl-sprite-qsort into next

This patch makes HWR_SortVisSprites faster by replacing selection sort ($O(n^2)) with quicksort. (O(n \log n)$)

Performance comparison:

Before After
before 952 microseconds after 114 microseconds
before 409 microseconds after 71 microseconds

Merge request reports