From d72839ce032d476ce0f76f2545961d722edb1669 Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 21 Dec 2015 18:42:39 +0000 Subject: [PATCH] .benchmarks git-svn-id: svn://ultimatepp.org/upp/trunk@9314 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- benchmarks/SimpleAlloc/SimpleAlloc.cpp | 23 +++++++++++++++++++++++ benchmarks/SimpleAlloc/SimpleAlloc.upp | 12 ++++++++++++ benchmarks/SimpleAlloc/init | 4 ++++ benchmarks/idmapBench/main.cpp | 4 ++++ 4 files changed, 43 insertions(+) create mode 100644 benchmarks/SimpleAlloc/SimpleAlloc.cpp create mode 100644 benchmarks/SimpleAlloc/SimpleAlloc.upp create mode 100644 benchmarks/SimpleAlloc/init diff --git a/benchmarks/SimpleAlloc/SimpleAlloc.cpp b/benchmarks/SimpleAlloc/SimpleAlloc.cpp new file mode 100644 index 000000000..cd5d7906a --- /dev/null +++ b/benchmarks/SimpleAlloc/SimpleAlloc.cpp @@ -0,0 +1,23 @@ +#include + +using namespace Upp; + +#define N 20000000 + +void *ptr[N]; + +CONSOLE_APP_MAIN +{ + { + TimeStop tm; + for(int i = 0; i < N; i++) + ptr[i] = new byte[32]; + RLOG("Alloc " << tm); + } + { + TimeStop tm; + for(int i = 0; i < N; i++) + delete[] ptr[i]; + RLOG("Free " << tm); + } +} diff --git a/benchmarks/SimpleAlloc/SimpleAlloc.upp b/benchmarks/SimpleAlloc/SimpleAlloc.upp new file mode 100644 index 000000000..39575f31a --- /dev/null +++ b/benchmarks/SimpleAlloc/SimpleAlloc.upp @@ -0,0 +1,12 @@ +description "Test growth speed of allocator\377"; + +uses + Core; + +file + SimpleAlloc.cpp; + +mainconfig + "" = "", + "" = "USEMALLOC"; + diff --git a/benchmarks/SimpleAlloc/init b/benchmarks/SimpleAlloc/init new file mode 100644 index 000000000..05f7d9397 --- /dev/null +++ b/benchmarks/SimpleAlloc/init @@ -0,0 +1,4 @@ +#ifndef _SimpleAlloc_icpp_init_stub +#define _SimpleAlloc_icpp_init_stub +#include "Core/init" +#endif diff --git a/benchmarks/idmapBench/main.cpp b/benchmarks/idmapBench/main.cpp index 27a06ddf9..89808e757 100644 --- a/benchmarks/idmapBench/main.cpp +++ b/benchmarks/idmapBench/main.cpp @@ -103,6 +103,10 @@ void BenchNTL(const char *file) { PrintMemoryTest("VectorMap"); +#ifdef flagMEMORYTEST + RLOG(order.GetCount()); +#endif + #ifndef NO_OUTPUT for(int i = 0; i < order.GetCount(); i++) { std::cout << ~map.GetKey(order[i]) << ": ";