Skip to content

Use a stable radix sort for larger translucent quad batches - #580

Open
BonsUnleashed wants to merge 1 commit into
FiniteReality:20.1/forgefrom
BonsUnleashed:bons-furious/embeddium-entity-sort-radix
Open

BonsUnleashed wants to merge 1 commit into
FiniteReality:20.1/forgefrom
BonsUnleashed:bons-furious/embeddium-entity-sort-radix

Conversation

@BonsUnleashed

Copy link
Copy Markdown

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. compileJava passes 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.

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.

1 participant