同一个exe分别从命令行和VS2005启动程序:计算函数执行的时间差在2个情况下存在太大的差异?
const int gnLoopCounts = 40000;
void testFreeAsStack(PMalloc _alloc, PFree _free)
{
vector<void*> vctPointer;
vctPointer.reserve(gnLoopCounts);
int i=0;
for (; i<gnLoopCounts; ++i)
{
void* pMem = _alloc(i+1);
if (NULL != pMem)
{
vctPointer.push_back(pMem);
memset(pMem, 0, i+1);
}
}
for (i=vctPointer.size()-1; i>=0; --i)
{
_free(vctPointer[i]);
}
}不管是Debug还是Release都存在此现象, 在_alloc, _free中计算2个函数的时间,并累加。以Release为例子,结果如下:
A:
从VS2005启动生成的exe:
分配与释放的总时间 = 5.897秒!
B:
从命令行启动VS2005生成的exe:
分配与释放的总时间 = 0.25秒!
问题描述:
1. 为什么A和B存在如此大的差别?
2. 用户在windows下执行exe是像A还是B?
...全文
相关推荐
VS2008转VS2005
转换VS2008的项目到VS2005版本的小工具 详细说明见:http://www.our-code.com/news/2009124/n19515.html
VS2005与VS2008兼容补丁,VS2008补丁,vs2005补丁
VS2005与VS2008兼容补丁,VS2008补丁,vs2005补丁
vs2008转换工程vs2005
可轻松把vs2008工程转换成vs2005
vs2008转vs2005
一个可以把VS2008做的项目 转成VS2005的 很实用
vs2010转vs2005
转自hhttp://blog.csdn.net/yes2/article/details/9005639,上传到这只为自己以后用时方便查找,很遗憾,哥们没公开源码


