diff --git a/ypsu.cpp b/ypsu.cpp index b84b723..acbd02c 100644 --- a/ypsu.cpp +++ b/ypsu.cpp @@ -232,12 +232,17 @@ static inline void do_thier3(uint32_t *a, int n) noexcept { static inline void do_rthier(uint32_t *a, int n) noexcept { assert(n * uint32_t(sizeof(a[0])) <= INT_MAX); if(n > 20000000) { + std::vector tmp(n); /* Helps a bit against our worst cases in big numbers */ uint32_t junk; - randominus(a, n, junk); + sch_rand_state state = schwab_rand_state(junk); + //randominus(a, n, junk); + //thiersort3(a, &(tmp[0]), n); // slower even with randominus + thiersort2(a, &(tmp[0]), n, &state); + } else { + std::vector tmp(n); + thiersort3(a, &(tmp[0]), n); } - std::vector tmp(n); - thiersort3(a, &(tmp[0]), n); } /** 3+1 pass bottom-up radix */ @@ -942,12 +947,6 @@ int main(int argc, char **argv) { } }); - w = v; - measure(inputtype, "magyar", [&] { - MagyarSort::sort(&w[0], w.size()); - }); - assert(w == expected); - /* w = v; measure(inputtype, "rmagyar", [&] { @@ -1095,6 +1094,13 @@ int main(int argc, char **argv) { assert(w == expected); */ + w = v; + measure(inputtype, "magyar", [&] { + MagyarSort::sort(&w[0], w.size()); + }); + assert(w == expected); + + for (auto r : results) printf("%9.3fs", r.second); puts(""); fflush(stdout);