#include <iostream>
#include <boost/timer.hpp>
int _tmain(int argc, _TCHAR* argv[])
{
boost::timer timer;
const unsigned int TEST_DATA_LEN = 1440*900;
char* pDataA = new char[TEST_DATA_LEN];
memset(pDataA, NULL, TEST_DATA_LEN);
char* pDataB = new char[TEST_DATA_LEN];
memset(pDataB, NULL, TEST_DATA_LEN);
double dCopyTime = 0;
timer.restart();
for (unsigned int uiLen = 0; uiLen < 1020; uiLen++)
{
memcpy(pDataA, pDataB, TEST_DATA_LEN);
}
dCopyTime = timer.elapsed();
std::cout << dCopyTime << std::endl;
double dMoveTime = 0;
timer.restart();
for (unsigned int uiLen = 0; uiLen < 1020; uiLen++)
{
memmove(pDataA, pDataA, TEST_DATA_LEN);
}
dMoveTime = timer.elapsed();
std::cout << dMoveTime << std::endl;
std::cout << "self copy lost:" << (dMoveTime - dCopyTime)*100 << std::endl;
return 0;
}