question when writing to a file

bearophile bearophileHUGS at lycos.com
Thu Mar 7 04:12:48 PST 2013


bioinfornatics:

> I mean if one way is more efficient by speed?

To be sure of what's faster you often have to write small 
benchmarks.

In this case this should be good:

import std.stdio, std.array;
void main() {
     writefln("%-(%s\n%)", ["hello"].replicate(5));
}


But if you want speed this is is probably faster:

import core.stdc.stdio: puts;
void main() {
     puts("hello\nhello\nhello\nhello\nhello");
}

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list