Repository navigation
Use a stable radix sort for larger translucent quad batches - #580
Open
BonsUnleashed wants to merge 1 commit into
Open
BonsUnleashed wants to merge 1 commit into
BonsUnleashed wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
This uses a stable radix sort for translucent quad batches with at least 64 entries. Smaller batches keep the current merge sort. Equal distances retain their input order, signed zeros compare equal, and any NaN key falls back to the existing sort.
The scratch arrays are local to each thread and retained only up to 65,536 entries. Larger batches use temporary scratch storage.
The equivalent change is prepared for Bons and Furious 1.0.30. Its checks compared about 35,000 orders with Embeddium's sort, including ties, infinities, signed zeros and random float bits, without a difference.
compileJavapasses for this upstream port. I have not measured frame times on this branch; the earlier isolated sorting results are not an FPS claim.Tests of this source compared 8,000 arrays with upstream MergeSort and a separate reference sort across four concurrent callers. They covered reused arrays, both size thresholds, signed zero, infinities, negative values, ties, random bit patterns and NaN fallback, with matching results.