ultimatepp/benchmarks/Sort/Sort.cpp
cxl 0f3b0f7376 uppsrc: docs & cosmetics
git-svn-id: svn://ultimatepp.org/upp/trunk@15254 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2020-10-15 13:14:48 +00:00

52 lines
876 B
C++

#include <Core/Core.h>
#include <TestData/TestData.h>
#include <algorithm>
#include <vector>
using namespace Upp;
CONSOLE_APP_MAIN
{
StdLogSetup(LOG_COUT|LOG_FILE);
RDUMP(AliceWords().GetCount());
for(int i = 0; i < 300; i++) {
Vector<String> w = AliceWords();
{
std::vector<std::string> x;
for(auto s : w)
x.push_back(s.ToStd());
RTIMING("std::sort std::vector<std::string>");
std::sort(x.begin(), x.end());
}
{
RTIMING("Sort Vector<String>");
Sort(w);
}
#if 0
ONCELOCK {
RDUMPC(w);
}
#endif
}
for(int i = 0; i < 300; i++) {
Vector<int> w;
for(int i = 0; i < 40000; i++)
w.Add(Random());
{
std::vector<int> x(w.begin(), w.end());
RTIMING("std::sort std::vector<int>");
std::sort(x.begin(), x.end());
}
{
RTIMING("Sort Vector<int>");
Sort(w);
}
#if 0
ONCELOCK {
RDUMPC(w);
}
#endif
}
}