Чисто ради интереса перевел вариант HolyDel'a на Ди:
import std.c.windows.windows : GetTickCount;
import std.stdio : writef, readln;
void main()
{
int counter = 0;
auto current = GetTickCount();
int[] map = new int[512 * 128 * 512];
int allocationTime = GetTickCount() - current;
current = 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 fillingTime = GetTickCount() - current;
writef("Allocation took: ", allocationTime, "ms\n");
writef("Total filling time: ", fillingTime, "ms\n");
writef("Average fill time per step: ", fillingTime/20, "ms\n");
readln();
}
dmd 1.071, ключи компиляции: -inline -O -release.
У меня результаты странные:
Allocation took: 141ms
Total filling time: 1734ms
Average fill time per step: 86ms
|
Проверьте плиз кому не лень.