#include #include #include #include using namespace Upp; CONSOLE_APP_MAIN { StdLogSetup(LOG_COUT|LOG_FILE); RDUMP(AliceWords().GetCount()); for(int i = 0; i < 300; i++) { Vector w = AliceWords(); std::vector x; { for(auto s : w) x.push_back(s.ToStd()); RTIMING("std::sort std::vector"); std::sort(x.begin(), x.end()); } { std::vector x; for(auto s : w) x.push_back(s.ToStd()); RTIMING("std::stable_sort std::vector"); std::stable_sort(x.begin(), x.end()); } Vector w2 = clone(w); { RTIMING("Sort Vector"); Sort(w2); } for(int i = 0; i < w2.GetCount(); i++) if(w2[i] != x[i]) Panic("Failed!"); /* { RTIMING("Sort Vector"); Sort(w); } */ #if 0 ONCELOCK { RDUMPC(w); } #endif } for(int i = 0; i < 300; i++) { Vector w; for(int i = 0; i < 40000; i++) w.Add(Random()); { std::vector x(w.begin(), w.end()); RTIMING("std::sort std::vector"); std::sort(x.begin(), x.end()); } { std::vector x(w.begin(), w.end()); RTIMING("std::sort std::vector"); std::sort(x.begin(), x.end()); } { RTIMING("Sort Vector"); Sort(w); } #if 0 ONCELOCK { RDUMPC(w); } #endif } }