эффективность работы программиста (когда дело касается не формошлепства) на С++ вещь спорная. такчто я вчеркнул его назад.
#include <iostream>
#include <Windows.h>
int main()
{
int counter = 0;
auto a = GetTickCount();
int* map = new int[512*128*512];
int allocate_time = GetTickCount() - a;
a = GetTickCount();
for(int i=0;i<20;++i)
{
for(int x =0;x<512;++x)
{
for(int y = 0;y<128;++y)
{
for(int z =0;z<512;++z)
{
++counter;
map[512 * 128 * x + 128 * y + z] = counter;
}
}
}
}
int fill_time = GetTickCount() - a;
std::cout<<"allocate time:"<<allocate_time<<std::endl;
std::cout<<"fill time:"<<(fill_time/20)<<std::endl;
std::cin.get();
return 0;
}
allocate - 0
fill - 17