mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-05 09:34:53 -06:00
.benchmarks
git-svn-id: svn://ultimatepp.org/upp/trunk@13417 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
ba0e9a594d
commit
3904c4977b
2 changed files with 61 additions and 0 deletions
52
benchmarks/StableSortValue/StableSortValue.cpp
Normal file
52
benchmarks/StableSortValue/StableSortValue.cpp
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
StdLogSetup(LOG_COUT|LOG_FILE);
|
||||
|
||||
Vector<Value> 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<Value> v2 = clone(vi);
|
||||
RTIMING("StableSort int");
|
||||
StableSort(v2);
|
||||
}
|
||||
{
|
||||
Vector<Value> v2 = clone(vf);
|
||||
RTIMING("StableSort double");
|
||||
StableSort(v2);
|
||||
}
|
||||
{
|
||||
Vector<Value> v2 = clone(vi64);
|
||||
RTIMING("StableSort int64");
|
||||
StableSort(v2);
|
||||
}
|
||||
{
|
||||
Vector<Value> v2 = clone(vs);
|
||||
RTIMING("StableSort String");
|
||||
StableSort(v2);
|
||||
}
|
||||
{
|
||||
Vector<Value> v2 = clone(vd);
|
||||
RTIMING("StableSort Date");
|
||||
StableSort(v2);
|
||||
}
|
||||
{
|
||||
Vector<Value> v2 = clone(vt);
|
||||
RTIMING("StableSort Time");
|
||||
StableSort(v2);
|
||||
}
|
||||
}
|
||||
}
|
||||
9
benchmarks/StableSortValue/StableSortValue.upp
Normal file
9
benchmarks/StableSortValue/StableSortValue.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
StableSortValue.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue