From 3904c4977baaf729b2d74387f9ffd6f2ea183e82 Mon Sep 17 00:00:00 2001 From: cxl Date: Tue, 18 Jun 2019 11:44:42 +0000 Subject: [PATCH] .benchmarks git-svn-id: svn://ultimatepp.org/upp/trunk@13417 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- .../StableSortValue/StableSortValue.cpp | 52 +++++++++++++++++++ .../StableSortValue/StableSortValue.upp | 9 ++++ 2 files changed, 61 insertions(+) create mode 100644 benchmarks/StableSortValue/StableSortValue.cpp create mode 100644 benchmarks/StableSortValue/StableSortValue.upp diff --git a/benchmarks/StableSortValue/StableSortValue.cpp b/benchmarks/StableSortValue/StableSortValue.cpp new file mode 100644 index 000000000..2f9e98388 --- /dev/null +++ b/benchmarks/StableSortValue/StableSortValue.cpp @@ -0,0 +1,52 @@ +#include + +using namespace Upp; + +CONSOLE_APP_MAIN +{ + StdLogSetup(LOG_COUT|LOG_FILE); + + Vector vi, vf, vd, vt, vi64, vs; + SeedRandom(0); + for(int i = 0; i < 1000000; i++) { + vi.Add((int)Random()); + vf.Add(Randomf()); + vi64.Add((int64)Random64()); + vt.Add(GetSysTime() + (int64)Random64()); + vd.Add(GetSysDate() + Random()); + vs.Add(AsString(Random())); + } + + for(int i = 0; i < 3; i++) { + { + Vector v2 = clone(vi); + RTIMING("StableSort int"); + StableSort(v2); + } + { + Vector v2 = clone(vf); + RTIMING("StableSort double"); + StableSort(v2); + } + { + Vector v2 = clone(vi64); + RTIMING("StableSort int64"); + StableSort(v2); + } + { + Vector v2 = clone(vs); + RTIMING("StableSort String"); + StableSort(v2); + } + { + Vector v2 = clone(vd); + RTIMING("StableSort Date"); + StableSort(v2); + } + { + Vector v2 = clone(vt); + RTIMING("StableSort Time"); + StableSort(v2); + } + } +} diff --git a/benchmarks/StableSortValue/StableSortValue.upp b/benchmarks/StableSortValue/StableSortValue.upp new file mode 100644 index 000000000..e6f6c0929 --- /dev/null +++ b/benchmarks/StableSortValue/StableSortValue.upp @@ -0,0 +1,9 @@ +uses + Core; + +file + StableSortValue.cpp; + +mainconfig + "" = ""; +