4 ms·
Gah, I did misunderstand some things. The picture is now worse than I realized! EDIT: and yet also better; see https://news.ycombinator.com/item?id=27951017 htt
by mlochbaum 5y ago
Gah, I did misunderstand some things. The picture is now worse than I realized! EDIT: and yet also better; see https://news.ycombinator.com/item?id=27951017 https://news.ycombinator.com/item?id=27951017 . It's hard to get it working right but this is a really fast algorithm.
fluxsort takes a function pointer and has no way to inline it. The fluxsort.c is included from fluxsort.h (this is not standard style by the way; template files should have a .h suffix), so the compiler might choose to inline it, and the benchmarks use noinline on the comparison functions to avoid this.
BlockQuicksort makes no sense without inlined comparisons. Yes, pdqsort allows a comparison function in order to be a general-purpose sort, but this isn't the case that it targets.
Are these benchmarks run with inline comparisons? Seems pretty hard to get bench.c to inline anything since test_sort takes a comparison function as input (though I'm working on it).
- acmj 5y agoMy biggest complaint about all scandum's sorting algorithms is that it doesn't support guaranteed inlined comparisons. Without this feature, the result depends on the compiler behavior, making the results hard to interpret. This point has been raised many times at reddit/hacker news but the dev is strong minded.
- scandum 5y agoYou can uncomment //#define cmp(a,b) (*(a) > *(b)) in quadsort.h for primitive inline comparisons.