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@13459 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
96f83e17d0
commit
9ebc87691e
8 changed files with 66 additions and 23 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
#include <Core/Core.h>
|
#include <Core/Core.h>
|
||||||
|
#include <plugin/lzma/lzma.h>
|
||||||
|
|
||||||
using namespace Upp;
|
using namespace Upp;
|
||||||
|
|
||||||
|
|
@ -12,23 +13,57 @@ struct Record {
|
||||||
|
|
||||||
CONSOLE_APP_MAIN
|
CONSOLE_APP_MAIN
|
||||||
{
|
{
|
||||||
String name = "c:/xxx/heap.bog";
|
StdLogSetup(LOG_COUT|LOG_FILE);
|
||||||
|
RLOG("Decompressing");
|
||||||
int64 l = GetFileLength(name);
|
Record *r;
|
||||||
Record *r = (Record *)malloc(l);
|
int64 l;
|
||||||
FileIn in(name);
|
{
|
||||||
if((l & 15) || in.Get64(r, l) != 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());
|
||||||
|
|
||||||
|
if(l & 15) {
|
||||||
Cout() << "Invalid input";
|
Cout() << "Invalid input";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
RTIMING("Heap");
|
int smalln = 0;
|
||||||
|
int largen = 0;
|
||||||
|
int hugen = 0;
|
||||||
|
|
||||||
Record *end = r + l / 16;
|
Record *end = r + l / 16;
|
||||||
while(r < end) {
|
for(Record *s = r; s < end; s++)
|
||||||
if(r->sz == 0xffffffffffffffff)
|
if(s->sz != 0xffffffffffffffff)
|
||||||
MemoryFree(ptr[r->ptr]);
|
if(s->sz <= 992)
|
||||||
else
|
smalln++;
|
||||||
ptr[r->ptr] = MemoryAlloc(r->sz);
|
else
|
||||||
r++;
|
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]);
|
||||||
|
else
|
||||||
|
ptr[r->ptr] = MemoryAlloc(r->sz);
|
||||||
|
r++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RDUMP(MemoryProfile());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
uses
|
uses
|
||||||
Core;
|
Core,
|
||||||
|
plugin/lzma;
|
||||||
|
|
||||||
file
|
file
|
||||||
HeapIde.cpp;
|
HeapIde.cpp;
|
||||||
|
|
|
||||||
BIN
benchmarks/HeapIde/ide.lzma
Normal file
BIN
benchmarks/HeapIde/ide.lzma
Normal file
Binary file not shown.
BIN
benchmarks/HeapIde/index3.lzma
Normal file
BIN
benchmarks/HeapIde/index3.lzma
Normal file
Binary file not shown.
|
|
@ -1,4 +1,5 @@
|
||||||
#include <Core/Core.h>
|
#include <Core/Core.h>
|
||||||
|
#include <plugin/lzma/lzma.h>
|
||||||
|
|
||||||
using namespace Upp;
|
using namespace Upp;
|
||||||
|
|
||||||
|
|
@ -6,12 +7,12 @@ CONSOLE_APP_MAIN
|
||||||
{
|
{
|
||||||
SetVppLogSizeLimit(INT_MAX);
|
SetVppLogSizeLimit(INT_MAX);
|
||||||
|
|
||||||
FileIn in("C:/upp/heap.log");
|
FileIn in("C:/xxx/heap.log");
|
||||||
FileOut out("C:/xxx/heap.bog");
|
|
||||||
|
|
||||||
Index<int> th;
|
Index<int> th;
|
||||||
Index<int64> ps;
|
Index<int64> ps;
|
||||||
|
|
||||||
|
StringStream out;
|
||||||
while(!in.IsEof()) {
|
while(!in.IsEof()) {
|
||||||
String s = in.GetLine();
|
String s = in.GetLine();
|
||||||
CParser p(s);
|
CParser p(s);
|
||||||
|
|
@ -37,6 +38,9 @@ CONSOLE_APP_MAIN
|
||||||
out.Put64(sz);
|
out.Put64(sz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RDUMP(ps.GetCount());
|
Cout() << "Pointers: " << ps.GetCount() << ", threads: " << th.GetCount() << '\n';
|
||||||
RDUMP(th.GetCount());
|
Cout() << "Compressing\n";
|
||||||
|
String s = LZMACompress(out.GetResult());
|
||||||
|
Cout() << "Compressed length: " << s.GetCount() << "\n";
|
||||||
|
SaveFile("c:/xxx/heap.lzma", s);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
uses
|
uses
|
||||||
Core;
|
Core,
|
||||||
|
plugin/lzma;
|
||||||
|
|
||||||
file
|
file
|
||||||
HeapLog.cpp;
|
HeapLog.cpp;
|
||||||
|
|
|
||||||
|
|
@ -7,5 +7,6 @@ file
|
||||||
|
|
||||||
mainconfig
|
mainconfig
|
||||||
"" = "USEMALLOC",
|
"" = "USEMALLOC",
|
||||||
"" = "";
|
"" = "",
|
||||||
|
"" = "HEAPLOG";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,5 +11,6 @@ mainconfig
|
||||||
"" = "USEMALLOC",
|
"" = "USEMALLOC",
|
||||||
"" = "MT",
|
"" = "MT",
|
||||||
"" = "USEMALLOC MT",
|
"" = "USEMALLOC MT",
|
||||||
"" = "USEMALLOC MEMORYTEST";
|
"" = "USEMALLOC MEMORYTEST",
|
||||||
|
"" = "HEAPLOG";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue