From 9a8eac6b6259107c32e2b2371fa8226fad797ea5 Mon Sep 17 00:00:00 2001 From: cxl Date: Sat, 16 Jan 2016 08:02:13 +0000 Subject: [PATCH] .benchmarks git-svn-id: svn://ultimatepp.org/upp/trunk@9399 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- benchmarks/AllMaps/AllMaps.upp | 1 + benchmarks/LongSort/LongSort.cpp | 29 +++++++++++++++++++++++++++++ benchmarks/LongSort/LongSort.upp | 11 +++++++++++ benchmarks/LongSort/init | 4 ++++ 4 files changed, 45 insertions(+) create mode 100644 benchmarks/LongSort/LongSort.cpp create mode 100644 benchmarks/LongSort/LongSort.upp create mode 100644 benchmarks/LongSort/init diff --git a/benchmarks/AllMaps/AllMaps.upp b/benchmarks/AllMaps/AllMaps.upp index 164f6eb97..99c9835c1 100644 --- a/benchmarks/AllMaps/AllMaps.upp +++ b/benchmarks/AllMaps/AllMaps.upp @@ -2,6 +2,7 @@ uses Core; file + test.txt, AllMaps.cpp optimize_speed; mainconfig diff --git a/benchmarks/LongSort/LongSort.cpp b/benchmarks/LongSort/LongSort.cpp new file mode 100644 index 000000000..a73a0fde0 --- /dev/null +++ b/benchmarks/LongSort/LongSort.cpp @@ -0,0 +1,29 @@ +#include +#include + +using namespace Upp; + +#define N 1000000 + +CONSOLE_APP_MAIN +{ + Vector a; + std::vector c; + for(int i = 0; i < N; i++) { + String s = AsString(Random()) + AsString(Random()) + + AsString(Random()) + AsString(Random()); + a.Add(s); + c.push_back(s.ToStd()); + } + + { + Vector b = clone(a); + RTIMING("Sort"); + Sort(b); + } + { + std::vector d = c; + RTIMING("std::sort"); + std::sort(d.begin(), d.end()); + } +} diff --git a/benchmarks/LongSort/LongSort.upp b/benchmarks/LongSort/LongSort.upp new file mode 100644 index 000000000..e7ee732e6 --- /dev/null +++ b/benchmarks/LongSort/LongSort.upp @@ -0,0 +1,11 @@ +description "Sorting non-SVO strings\377"; + +uses + Core; + +file + LongSort.cpp; + +mainconfig + "" = ""; + diff --git a/benchmarks/LongSort/init b/benchmarks/LongSort/init new file mode 100644 index 000000000..095879d44 --- /dev/null +++ b/benchmarks/LongSort/init @@ -0,0 +1,4 @@ +#ifndef _LongSort_icpp_init_stub +#define _LongSort_icpp_init_stub +#include "Core/init" +#endif