Implemented introspective sort :
- DPQS;
- pivots selected thanks to median-of-3 algo;
- quitting recursive sort through depth (apply heap-sort) or threshold (number of item in array < 17).
Differential D240
Fix PawSort (intro_sort and heap_sort) lulu731 on Aug 13 2018, 8:34 AM. Authored by
Details
Implemented introspective sort :
Added tests for insertion_sort.
Diff Detail
Event TimelineComment Actions Build is green Building PawLIB on LittleXenial as build 466. https://jenkins.mousepawmedia.net:8449/job/pawlib_build/466/ for more details. Comment Actions Thanks @lulu731! However, before I can review, we need your signature on {L5} for legal reasons. If you have any questions about our Terms of Development, don't hesitate to ask. :) Comment Actions Some super minor things. You can probably address these at the same time as your additional improvements; just keep working on the same branch, and run the usual... git add . git commit arc diff ...to update this Differential.
This comment was removed by jcmcdonald. Comment Actions introsort implemented with DPQS, median-of-3 pivots and heap_sort. Updating D240: Fix Insertion Sort
Comment Actions Build has FAILED Building PawLIB on LittleXenial as build 472. Link to build: https://jenkins.mousepawmedia.net:8449/job/pawlib_build/472/ Comment Actions @lulu731 Oh! I think I know what's going on. In D241: PawLIB: Use CPGF 1.6.0/rPf93584d74597: PawLIB: Use CPGF 1.6.0, I upgraded PawLIB to use CPGF 1.6.0, and I updated the dependencies on Jenkins to provide CPGF 1.6.0. However, because you last pulled from master before D241 landed, you've got old code. In other words, the fix is simple: switch to and update your copy of master, and then rebase your introsort branch off the new master. Before you do this, make sure you don't have any uncommitted changes; if you have uncommitted changes, git stash them first, and then git stash pop them after the rebase. git checkout master git pull origin master git checkout introsort git rebase master Comment Actions In addition to my above comment, could you please update the description on this Differential Revision (Edit Revision up above) to reflect the whole gamut of changes you're making? Thanks! Comment Actions The lint warnings may not be strictly necessary, but they're really a good idea to address. We really do need to get into the habit of using override around here, and I need to introduce it into the code elsewhere. Our standard is to only land code once the lint is clean. (In the rare case the linter is in actual error, we manually suppress the warning on that particular line; that's not necessary to do here.) Comment Actions
Comment Actions Build is green Building PawLIB on LittleXenial as build 473. https://jenkins.mousepawmedia.net:8449/job/pawlib_build/473/ for more details.
Comment Actions Great progress! All the tests are passing. (See below in this comment for the benchmark results). A few things need to be sorted out about the tests. See inline comments. Also, (as mentioned in the previous comment, please don't add .gitignore to .gitignore. That file should be tracked. Third, it seems the PawSort test suite is being registered under the wrong name (P-sB40 instead of P-sB30). It appears that the OneString suite was mistakenly given this suite's assigned ID...in other words, they're swapped. Could you untangle that in pawlib-tester/main.cpp:87-88? In other news, here's the benchmark results for PawSort right now! You can run each of these via ./tester --benchmark P-tB3001 (or whatever the ID is):
After landing this, we'll want to look into why the other tests fail. This algorithm seems especially vulnerable to scenarios with few unique items, or where the array is *mostly* sorted. Nightmare is also a problem: I wrote it specifically to cause problems for std::sort. NOTE: As you might know, you never run benchmarks on Debug, as -g can throw things off (especially in our favor).
Comment Actions
Comment Actions Bravo! Landing it to master is simple: arc land introsort. Then, you can make a new branch and start on whatever's next. Comment Actions Build is green Building PawLIB on LittleXenial as build 480. https://jenkins.mousepawmedia.net:8449/job/pawlib_build/480/ for more details. |