mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
.benchmarks
git-svn-id: svn://ultimatepp.org/upp/trunk@14516 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
3b78f886f1
commit
9131c802cb
8 changed files with 151 additions and 0 deletions
51
benchmarks/StringEq/StringEq.cpp
Normal file
51
benchmarks/StringEq/StringEq.cpp
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
int found;
|
||||
|
||||
void Test(const char *name, const Vector<String>& patterns)
|
||||
{
|
||||
Vector<String> p = clone(patterns);
|
||||
|
||||
Vector<String> data;
|
||||
for(int i = 0; i < 1000; i++)
|
||||
data << String(~p[Random(p.GetCount())]);
|
||||
|
||||
while(p.GetCount() < 1000)
|
||||
p.Append(clone(p));
|
||||
|
||||
int rfound = 0;
|
||||
for(int i = 0; i < p.GetCount(); i++)
|
||||
for(int j = 0; j < data.GetCount(); j++)
|
||||
if(strcmp(p[i], data[j]) == 0)
|
||||
rfound++;
|
||||
|
||||
found = 0;
|
||||
double tm1 = usecs();
|
||||
for(int q = 0; q < 1000; q++)
|
||||
for(int i = 0; i < p.GetCount(); i++)
|
||||
for(int j = 0; j < data.GetCount(); j++)
|
||||
if(p[i] == data[j])
|
||||
found++;
|
||||
double tm2 = usecs();
|
||||
|
||||
if(1000 * rfound != found)
|
||||
Panic("Failed");
|
||||
|
||||
RLOG(name << (tm2 - tm1) / p.GetCount() / data.GetCount() << " ns");
|
||||
}
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
StdLogSetup(LOG_FILE|LOG_COUT);
|
||||
|
||||
SeedRandom(0);
|
||||
|
||||
Test("10 bytes ", { "0123456789", "012345678A" });
|
||||
Test("20 bytes ", { "01234567890123456789", "0123456789012345678A" });
|
||||
Test("40 bytes ", { "0123456789012345678901234567890123456789", "012345678901234567890123456789012345678A" });
|
||||
Test("80 bytes ", { "01234567890123456789012345678901234567890123456789012345678901234567890123456789",
|
||||
"0123456789012345678901234567890123456789012345678901234567890123456789012345678A", });
|
||||
Test("Mixed ", { "01234567890123456789", "0123456789A", "0123456789012345678A2", "012345678901", "012345678901234567890123456789012345678A" });
|
||||
}
|
||||
10
benchmarks/StringEq/StringEq.upp
Normal file
10
benchmarks/StringEq/StringEq.upp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
StringEq.cpp,
|
||||
info.txt;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
57
benchmarks/StringEq/info.txt
Normal file
57
benchmarks/StringEq/info.txt
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
OLD
|
||||
* C:\upp\out\benchmarks\CLANGx64.Debug_Full.Release\StringEq.exe 29.05.2020 17:58:56, user: cxl
|
||||
|
||||
10 bytes 2.6879423828125 ns
|
||||
20 bytes 7.9278623046875 ns
|
||||
40 bytes 8.4329384765625 ns
|
||||
80 bytes 10.6320703125 ns
|
||||
Mixed 5.1026875 ns
|
||||
|
||||
NEW
|
||||
* C:\upp\out\benchmarks\CLANGx64.Debug_Full.Release\StringEq.exe 29.05.2020 17:57:23, user: cxl
|
||||
|
||||
10 bytes 2.398326171875 ns
|
||||
20 bytes 7.5932763671875 ns
|
||||
40 bytes 8.0952783203125 ns
|
||||
80 bytes 8.6923046875 ns
|
||||
Mixed 3.36159609375 ns
|
||||
|
||||
LEq, int64 compare
|
||||
10 bytes 2.183017578125 ns
|
||||
20 bytes 7.1306259765625 ns
|
||||
40 bytes 7.6494228515625 ns
|
||||
80 bytes 8.2265615234375 ns
|
||||
Mixed 4.9046890625 ns
|
||||
|
||||
====================
|
||||
OLD
|
||||
* C:\upp\out\benchmarks\MSBT19.Debug_Full.Release\StringEq.exe 29.05.2020 18:01:07, user: cxl
|
||||
|
||||
10 bytes 3.3761689453125 ns
|
||||
20 bytes 8.996029296875 ns
|
||||
40 bytes 10.872193359375 ns
|
||||
80 bytes 15.7719912109375 ns
|
||||
Mixed 7.46995703125 ns
|
||||
|
||||
NEW
|
||||
|
||||
|
||||
|
||||
===================
|
||||
10 bytes 1.8552822265625 ns
|
||||
20 bytes 7.9439384765625 ns
|
||||
40 bytes 8.4297197265625 ns
|
||||
80 bytes 9.12219921875 ns
|
||||
Mixed 5.43371484375 ns
|
||||
|
||||
10 bytes 1.8308798828125 ns
|
||||
20 bytes 7.4739130859375 ns
|
||||
40 bytes 8.091583984375 ns
|
||||
80 bytes 8.5558212890625 ns
|
||||
Mixed 5.6877921875 ns
|
||||
|
||||
10 bytes 1.8308798828125 ns
|
||||
20 bytes 7.4739130859375 ns
|
||||
40 bytes 8.091583984375 ns
|
||||
80 bytes 8.5558212890625 ns
|
||||
Mixed 5.6877921875 ns
|
||||
16
benchmarks/VectorInt/VectorInt.cpp
Normal file
16
benchmarks/VectorInt/VectorInt.cpp
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
#define N 1000000
|
||||
#define SZ 100
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
RTIMING("Time");
|
||||
for(int i = 0; i < N; i++) {
|
||||
Vector<int> v;
|
||||
for(int n = 0; n < SZ; n++)
|
||||
v.Add(n);
|
||||
}
|
||||
}
|
||||
9
benchmarks/VectorInt/VectorInt.upp
Normal file
9
benchmarks/VectorInt/VectorInt.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
VectorInt.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
|
|
@ -4,6 +4,7 @@ uses
|
|||
Core;
|
||||
|
||||
file
|
||||
info.txt,
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
|
|
|
|||
2
benchmarks/idmapBench/info.txt
Normal file
2
benchmarks/idmapBench/info.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
OLD: VectorMap time: 5742398 ms
|
||||
NEW: VectorMap time: 5888610 ms
|
||||
|
|
@ -328,13 +328,17 @@ CONSOLE_APP_MAIN
|
|||
fn = argv[0];
|
||||
|
||||
LoadFile(fn); // cache the file
|
||||
BenchNTL(fn); // alloc memory
|
||||
|
||||
#ifdef UPP_HEAP
|
||||
MemoryProfile f;
|
||||
// RLOG(f);
|
||||
// allocated_bytes0 = GetAllocatedBytes(f);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
{
|
||||
TimeStop tm;
|
||||
for(int n = 0; n < N; n++)
|
||||
|
|
@ -361,6 +365,7 @@ CONSOLE_APP_MAIN
|
|||
BenchSortedVectorMap(fn);
|
||||
RLOG("SortedVectorMap time: " << tm.Elapsed() << " ms");
|
||||
}
|
||||
#endif
|
||||
{
|
||||
TimeStop tm;
|
||||
for(int n = 0; n < N; n++)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue