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;
时间: 2024-12-22 04:23:59