.benchmarks

git-svn-id: svn://ultimatepp.org/upp/trunk@13459 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2019-06-30 12:31:22 +00:00
parent 96f83e17d0
commit 9ebc87691e
8 changed files with 66 additions and 23 deletions

View file

@ -1,4 +1,5 @@
#include <Core/Core.h>
#include <plugin/lzma/lzma.h>
using namespace Upp;
@ -12,18 +13,49 @@ struct Record {
CONSOLE_APP_MAIN
{
String name = "c:/xxx/heap.bog";
StdLogSetup(LOG_COUT|LOG_FILE);
RLOG("Decompressing");
Record *r;
int64 l;
{
String s = LZMADecompress(LoadDataFile(
// "ide.lzma"
"index3.lzma"
));
l = s.GetCount();
RLOG("decompressed size: " << l << ", records: " << l / 16);
r = (Record *)malloc(l);
memcpy(r, ~s, l);
RDUMP(MemoryProfile());
}
RDUMP(MemoryProfile());
int64 l = GetFileLength(name);
Record *r = (Record *)malloc(l);
FileIn in(name);
if((l & 15) || in.Get64(r, l) != l) {
if(l & 15) {
Cout() << "Invalid input";
exit(1);
}
RTIMING("Heap");
int smalln = 0;
int largen = 0;
int hugen = 0;
Record *end = r + l / 16;
for(Record *s = r; s < end; s++)
if(s->sz != 0xffffffffffffffff)
if(s->sz <= 992)
smalln++;
else
if(s->sz < 255 * 256)
largen++;
else
hugen++;
RDUMP(smalln);
RDUMP(largen);
RDUMP(hugen);
{
RTIMING("Heap");
while(r < end) {
if(r->sz == 0xffffffffffffffff)
MemoryFree(ptr[r->ptr]);
@ -31,4 +63,7 @@ CONSOLE_APP_MAIN
ptr[r->ptr] = MemoryAlloc(r->sz);
r++;
}
}
RDUMP(MemoryProfile());
}

View file

@ -1,5 +1,6 @@
uses
Core;
Core,
plugin/lzma;
file
HeapIde.cpp;

BIN
benchmarks/HeapIde/ide.lzma Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,4 +1,5 @@
#include <Core/Core.h>
#include <plugin/lzma/lzma.h>
using namespace Upp;
@ -6,12 +7,12 @@ CONSOLE_APP_MAIN
{
SetVppLogSizeLimit(INT_MAX);
FileIn in("C:/upp/heap.log");
FileOut out("C:/xxx/heap.bog");
FileIn in("C:/xxx/heap.log");
Index<int> th;
Index<int64> ps;
StringStream out;
while(!in.IsEof()) {
String s = in.GetLine();
CParser p(s);
@ -37,6 +38,9 @@ CONSOLE_APP_MAIN
out.Put64(sz);
}
}
RDUMP(ps.GetCount());
RDUMP(th.GetCount());
Cout() << "Pointers: " << ps.GetCount() << ", threads: " << th.GetCount() << '\n';
Cout() << "Compressing\n";
String s = LZMACompress(out.GetResult());
Cout() << "Compressed length: " << s.GetCount() << "\n";
SaveFile("c:/xxx/heap.lzma", s);
}

View file

@ -1,5 +1,6 @@
uses
Core;
Core,
plugin/lzma;
file
HeapLog.cpp;

View file

@ -7,5 +7,6 @@ file
mainconfig
"" = "USEMALLOC",
"" = "";
"" = "",
"" = "HEAPLOG";

View file

@ -11,5 +11,6 @@ mainconfig
"" = "USEMALLOC",
"" = "MT",
"" = "USEMALLOC MT",
"" = "USEMALLOC MEMORYTEST";
"" = "USEMALLOC MEMORYTEST",
"" = "HEAPLOG";