summaryrefslogtreecommitdiff
path: root/wikisort.c
Commit message (Collapse)AuthorAgeFilesLines
* Optimize rotateBobby Bingham2014-08-181-2/+2
| | | | | | | | | | | | | | | Previously, we used three rotations. This was simple, but was aggressively inlined by gcc at higher optimization levels, massively bloating the code. Now, we take the front of the array, which is to be rotated to the end, and using a series of swaps, move it progressively closer to the end. When we can no longer perform a swap of the required size because we're too close to the end, we view the remaining operation as a rotate to the right with a smaller shift size. We repeat as necessary. This generates somewhat smaller code than the three reverses, even at -Os. It also shows up to a 25% overall performance improvement for grailsort on some inputs.
* Move wikisort/grailsort common code to a shared headerBobby Bingham2014-07-061-101/+3
|
* Remove unnecessary safeguard in rotateBobby Bingham2014-06-301-1/+0
|
* Move penda info into a struct arrayBobby Bingham2014-06-301-24/+25
|
* Small cleanupBobby Bingham2014-06-301-5/+2
|
* Use an array structure to track the temp bufferBobby Bingham2014-06-301-12/+13
|
* Rename stract blockarray to more generic "array"Bobby Bingham2014-06-291-15/+15
|
* Don't bother merging when there are no pending elementsBobby Bingham2014-06-291-3/+6
|
* Don't roll a b block if it doesn't make sense toBobby Bingham2014-06-291-6/+2
| | | | | | | This added a pathological case where each iteration we'd roll a b block into place, just to have to do a giant rotate to move all the accumulated b blocks over to make room for the a block that should have been inserted next.
* Add wikisort optimizations for some common casesBobby Bingham2014-06-291-0/+9
|
* Initial stab at wikisortBobby Bingham2014-06-291-0/+224