};
//CMemoryPool
CMTMemoryPool
void testFun()
{
int i;
const int nLoop = 10;
const int nCount = 10000;
for(int j = 0; j
typedef CTest* LPTest;
LPTest arData[nCount];
for(i=0;i
arData[i] = new CTest;
}
for(i=0;i
delete arData[i];
}
}
}
int main(int argc, char* argv[])
{
{
unsigned int dwStartTickCount = GetTickCount();
CTest::NewPool();
testFun();
CTest::DeletePool();
cout << "total cost" << GetTickCount() - dwStartTickCount << endl;
}
system("pause");
return 0;
}
在我机器上测试结果比系统默认的CRT实现高效N倍。
摘自 厚积薄发