the test result on my computer:
//case 1
2153 // not using pool
16 // using pool
//case 2
15 // not using pool
32 // using pool
// case 3
2668 // not using pool
14976 // using pool
Press any key to continue . . .
main.cpp
#include #include "test.h"
int wmain()
{
test0(10000);
test1(10000);
test2(10000);
test3(10000);
test4(10000);
test5(10000);
system("pause");
return 0;
}
test.h
#pragma once
void test0(int loops);
void test1(int loops);
void test2(int loops);
void test3(int loops);
void test4(int loops);
void test5(int loops);
test.cpp
#include
#include
#include
#include
#include
#include
#include "test.h"
using namespace std;
class AAA
{
public:
AAA()
{
// cout << "con" << endl;
}
~AAA()
{
// cout << "descon" << endl;
}
public:
int a;
char b;
short int c;
vector d;
};
void test0(int loops)
{
char ** p = new char*[loops];
DWORD tick = GetTickCount();
for (int i=0; i memory\_pool(32);
for (int i=0; i v;
for (int i=0; i > v;
for (int i=0; i obj\_pool;
for (int i=0; i