why the release version memset is slower than debug version in visual studio 2012?
in visual sutido 2010, it is that result too.
my computer:
Intel Core i7-3770 3.40GHz
8G memory
os:
windows 7 sp1 64bit
this is my test code:
#include <boost/progress.hpp>
int main()
{
const int Size = 1000*1024*1024;
char* Data = (char*)malloc(Size);
#ifdef _DEBUG
printf_s("debug
");
#else
printf_s("release
");
#endif
boost::progress_timer timer;
memset(Data, 0, Size);
return 0;
}
the output:
release
0.27 s
debug
0.06 s
edited:
if i change code to this, it will get the same result:
#include <boost/progress.hpp>
int main()
{
const int Size = 1000*1024*1024;
char* Data = (char*)malloc(Size);
memset(Data, 1, Size);
#ifdef _DEBUG
printf_s("debug
");
#else
printf_s("release
");
#endif
{
boost::progress_timer timer;
memset(Data, 0, Size);
}
return 0;
}
so Hans Passant is right, thank you very much.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…