VS2013下在 性能和诊断 模式下运行速度非常快所带来的问题
[解决办法]
你用的f5还是ctrl_f5?
[解决办法]
上面那个搞错了,那个是debug的,这才是release的
4.700896s wall, 4.524029s user + 0.093601s system = 4.617630s CPU (98.2%)
new ok
345.851183s wall, 342.032193s user + 0.031200s system = 342.063393s CPU (98.9%)
delete ok
请按任意键继续. . .
0.555203s wall, 0.452403s user + 0.015600s system = 0.468003s CPU (84.3%)
new ok
0.234508s wall, 0.234002s user + 0.000000s system = 0.234002s CPU (99.8%)
delete ok
请按任意键继续. . .
这是启动性能分析的,差距好夸张~
这是测试代码
#include "stdafx.h"
#include <iostream>
#include <boost/timer/timer.hpp>
using namespace std;
int main()
{
int loop_size = 64 * 80000;
vector<pair<double, int>* > mysize(loop_size);
{
boost::timer::auto_cpu_timer timer;
for (int i = 0; i < loop_size; i++)
{
mysize[i] = new pair<double, int>();
}
}
cout << "new ok" << endl;
{
boost::timer::auto_cpu_timer timer;
for (int i = 0; i < loop_size; i++)
{
delete mysize[i];
}
}
cout << "delete ok" << endl;
system("pause");
return 0;
}