码迷,mamicode.com
首页 > 其他好文 > 详细

内存分配速度的一点测试

时间:2015-04-25 23:57:28      阅读:320      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!