mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
.benchmarks
git-svn-id: svn://ultimatepp.org/upp/trunk@9314 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
994b9dacaf
commit
d72839ce03
4 changed files with 43 additions and 0 deletions
23
benchmarks/SimpleAlloc/SimpleAlloc.cpp
Normal file
23
benchmarks/SimpleAlloc/SimpleAlloc.cpp
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
12
benchmarks/SimpleAlloc/SimpleAlloc.upp
Normal file
12
benchmarks/SimpleAlloc/SimpleAlloc.upp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
description "Test growth speed of allocator\377";
|
||||
|
||||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
SimpleAlloc.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "",
|
||||
"" = "USEMALLOC";
|
||||
|
||||
4
benchmarks/SimpleAlloc/init
Normal file
4
benchmarks/SimpleAlloc/init
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _SimpleAlloc_icpp_init_stub
|
||||
#define _SimpleAlloc_icpp_init_stub
|
||||
#include "Core/init"
|
||||
#endif
|
||||
|
|
@ -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]) << ": ";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue