A file reading benchmark

bearophile bearophileHUGS at lycos.com
Fri Feb 17 17:46:36 PST 2012


> (the D version runs in 13.20 seconds if I don't disable the GC).

Sorry, I have forgotten the version of the D code with GC disabling:


import std.stdio, std.string, std.array, core.memory;

void main(in string[] args) {
    GC.disable();
    Appender!(string[][]) rows;
    foreach (line; File(args[1]).byLine())
        rows.put(line.idup.split("\t"));
    writeln(rows.data[1].join(","));
}

Bye,
bearophile


More information about the Digitalmars-d mailing list