stdio and Tango I/O performance

Walter Bright newshound at digitalmars.com
Wed Mar 21 11:55:23 PDT 2007


Andrei Alexandrescu (See Website For Email) wrote:
> Could you please put the gun down. Sheesh. Which comments? What vein? It 
> was a question. I simply asked whether there has been performance work 
> on Tango's I/O, without having any prior experience with it. I don't see 
> reason for anyone to get offended about that.

Phobos' std.stdio's performance sucked because I'd never done a 
benchmark of it. It was one of those things I cranked out because 
something was needed, intending to go back and optimize later but never 
did...

Anyhow, Andrei's and my experiments with stdio once again showed that 
designing something to be fast and it actually being fast are two very 
different things. We were misled several times by our own preconceived 
notions about what was cheap and what was expensive. Nothing beats 
actually running a benchmark.

The benchmarks we used were all trivial programs, like a loop that just 
reads its stdin, line by line, and then stuffing a 30 Mb file down its 
maw. For example:

import std.stdio;

int main()
{
     char[] buf;
     while (readln(stdin, buf))
      { }
     return 0;
}

Yes, readln() will be in the next update.

Our benchmarking also suggested a couple performance related 
improvements to the gc interface, which I am working on.



More information about the Digitalmars-d mailing list