diff --git a/benchmarks/HeapIde/HeapIde.cpp b/benchmarks/HeapIde/HeapIde.cpp index 692c849c4..76ab50bec 100644 --- a/benchmarks/HeapIde/HeapIde.cpp +++ b/benchmarks/HeapIde/HeapIde.cpp @@ -1,4 +1,5 @@ #include +#include using namespace Upp; @@ -12,23 +13,57 @@ struct Record { CONSOLE_APP_MAIN { - String name = "c:/xxx/heap.bog"; - - int64 l = GetFileLength(name); - Record *r = (Record *)malloc(l); - FileIn in(name); - if((l & 15) || in.Get64(r, l) != l) { + 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()); + + if(l & 15) { Cout() << "Invalid input"; exit(1); } - RTIMING("Heap"); + int smalln = 0; + int largen = 0; + int hugen = 0; + Record *end = r + l / 16; - while(r < end) { - if(r->sz == 0xffffffffffffffff) - MemoryFree(ptr[r->ptr]); - else - ptr[r->ptr] = MemoryAlloc(r->sz); - r++; + 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]); + else + ptr[r->ptr] = MemoryAlloc(r->sz); + r++; + } } + + RDUMP(MemoryProfile()); } diff --git a/benchmarks/HeapIde/HeapIde.upp b/benchmarks/HeapIde/HeapIde.upp index f116fa55c..d96812fcd 100644 --- a/benchmarks/HeapIde/HeapIde.upp +++ b/benchmarks/HeapIde/HeapIde.upp @@ -1,5 +1,6 @@ uses - Core; + Core, + plugin/lzma; file HeapIde.cpp; diff --git a/benchmarks/HeapIde/ide.lzma b/benchmarks/HeapIde/ide.lzma new file mode 100644 index 000000000..3c4558de8 Binary files /dev/null and b/benchmarks/HeapIde/ide.lzma differ diff --git a/benchmarks/HeapIde/index3.lzma b/benchmarks/HeapIde/index3.lzma new file mode 100644 index 000000000..2a559afb9 Binary files /dev/null and b/benchmarks/HeapIde/index3.lzma differ diff --git a/benchmarks/HeapLog/HeapLog.cpp b/benchmarks/HeapLog/HeapLog.cpp index f5f5c353c..66330c347 100644 --- a/benchmarks/HeapLog/HeapLog.cpp +++ b/benchmarks/HeapLog/HeapLog.cpp @@ -1,4 +1,5 @@ #include +#include 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 th; Index 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); } diff --git a/benchmarks/HeapLog/HeapLog.upp b/benchmarks/HeapLog/HeapLog.upp index 77fac1531..c1f1a9082 100644 --- a/benchmarks/HeapLog/HeapLog.upp +++ b/benchmarks/HeapLog/HeapLog.upp @@ -1,5 +1,6 @@ uses - Core; + Core, + plugin/lzma; file HeapLog.cpp; diff --git a/benchmarks/Index3/Index3.upp b/benchmarks/Index3/Index3.upp index 3f279fdd0..1aee1deac 100644 --- a/benchmarks/Index3/Index3.upp +++ b/benchmarks/Index3/Index3.upp @@ -7,5 +7,6 @@ file mainconfig "" = "USEMALLOC", - "" = ""; + "" = "", + "" = "HEAPLOG"; diff --git a/benchmarks/idmapBench/idmapBench.upp b/benchmarks/idmapBench/idmapBench.upp index 83154451e..b988d99f0 100644 --- a/benchmarks/idmapBench/idmapBench.upp +++ b/benchmarks/idmapBench/idmapBench.upp @@ -11,5 +11,6 @@ mainconfig "" = "USEMALLOC", "" = "MT", "" = "USEMALLOC MT", - "" = "USEMALLOC MEMORYTEST"; + "" = "USEMALLOC MEMORYTEST", + "" = "HEAPLOG";