On 11/10/2010 11:33 AM, Xie wrote:
Can't run a simple program. What's wrong, GC?

import std.stdio;
import std.date;

void f0()
{
        wstring a[];

        foreach(i; 0 .. 100_000_000)
        {
                a ~= " "w;
        }
}

void main()
{
        auto r = benchmark!(f0)(1);
        writeln(r, "ms");
}

DMD 2.047

In addition to what everybody else is suggesting you look at, you may want to look into using an appender (defined in std.array). Not sure if it will help with the memory usage, but it's supposed to be faster for appending data to an array.

Casey

Reply via email to