Andrei's Google Talk

bearophile bearophileHUGS at lycos.com
Tue Aug 3 17:45:29 PDT 2010


Adam Ruppe:
> D2's (relative) slowness I've tracked down to import std.stdio; - it
> instantiates a bunch of templates just on import. We should be able to
> fix this with a little work, and put D even further ahead of the
> competition.

I have done two little benchmarks, using dmd 2.047, compiling just with "dmd test.d":

import std.c.stdio: printf;
void main() {
    printf("%d\n", 10);
}


import std.stdio: writeln;
void main() {
    writeln(10);
}

The program with printf compiles in 0.05 seconds, and the binary is 101_404 bytes, while the program with writeln compiles in about 0.30 seconds and produces a binary of 235_036 bytes, the asm shows tons of templates and functions.

Bye,
bearophile


More information about the Digitalmars-d mailing list