首页 > 其他 > 详细

内存分配速度的一点测试

时间:2015-04-25 23:55:45      阅读:351      评论:0      收藏:0      [点我收藏+]
LARGE_INTEGER litmp;
LARGE_INTEGER qt1, qt2;
QueryPerformanceFrequency(&litmp); double dff = (double)litmp.QuadPart; QueryPerformanceCounter(&qt1); int *a = NULL; for (int i = 0; i < 700; ++i) { for (int j = 0; j < 700; ++j) { a = new int[4]; } } QueryPerformanceCounter(&qt2); float ms = ((float)qt2.QuadPart - (float)qt1.QuadPart) * 1000 / dff; cout<<"time cost: "<<ms<<endl; int *b; QueryPerformanceCounter(&qt1); b = new int[14 * 700 * 700]; QueryPerformanceCounter(&qt2); ms = ((float)qt2.QuadPart - (float)qt1.QuadPart) * 1000 / dff; cout<<"time cost: "<<ms<<endl;

内存分配速度的一点测试

原文:http://www.cnblogs.com/duzib/p/4457117.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!