import std.c.windows.windows : GetTickCount;
import std.stdio : writefln, readln;
void main()
{
int counter = 0;
auto current = GetTickCount();
scope map = new int[512 * 128 * 512];
int allocationTime = GetTickCount() - current;
writefln("Allocation took: %dms", allocationTime);
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;
writefln("Total filling time: %dms", fillingTime);
writefln("Average fill time per step: %dms", fillingTime/20);
readln();
}
Версия для D 2.056.
Результаты чуток получше, но, увы...
Allocation took: 125ms
Total filling time: 1609ms
Average fill time per step: 80ms
|
Ди, к сожалению, далеко не конкурент С++