.benchmarks

git-svn-id: svn://ultimatepp.org/upp/trunk@11632 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2017-12-26 22:13:30 +00:00
parent f6fc5c2afb
commit 0f2ed8ca3c
2 changed files with 63 additions and 0 deletions

View file

@ -0,0 +1,54 @@
#include <Core/Core.h>
#include <queue>
using namespace Upp;
#ifdef _DEBUG
#define M 1
#define N 10
#else
#define M 10000
#define N 100
#endif
CONSOLE_APP_MAIN
{
Vector<int> data;
for(int j = 0; j < M; j++) {
for(int i = 0; i < N; i++)
data.Add(Random());
{
RTIMING("std::priority_queue");
std::priority_queue<int> pq;
for(int i = 0; i < N; i++)
pq.push(data[i]);
while(pq.size()) {
DUMP(pq.top());
pq.pop();
}
}
LOG("----------------------");
LOG("----------------------");
{
RTIMING("SortedIndex");
SortedIndex<int> sv;
for(int i = 0; i < N; i++)
sv.FindAdd(data[i]);
while(sv.GetCount()) {
DUMP(sv.Top());
sv.Drop();
}
}
}
}
/*
PriorityQueue<int, String> pq;
pq.GetCount();
pq.Trim();
pq.Top();
pq.TopKey();
pq.Drop();
pq.Pop();
*/

View file

@ -0,0 +1,9 @@
uses
Core;
file
InVectorVsHeap.cpp;
mainconfig
"" = "";