向量性能测试代码
发布时间
阅读量:
阅读量
#include "..\..\include\stlExample\Containers.h"
#include "..\..\include\stlExample\StopWatch.h"
//#include "StopWatch.h"
#include <iostream>
#include <boost/progress.hpp>
#include <list>
using namespace std;
//vector性能测试
void Containers::vectorPerformanceTest()
{
StopWatch sw; //时间处理类
TestRunAggregater tg; //运行时间
tg.test1 = 0; //微秒
tg.test2 = 0; //毫秒
tg.test3 = 0; //秒
// #1: 通过提前保留vector的大小,避免不必要的重新分配和复制周期。
cout << "\n(1): 通过提前保留vector的大小,避免不必要的重新分配和复制周期";
vector<BigTestStruct> testVector1;
vec
全部评论 (0)
还没有任何评论哟~
