Strange measurements when reproducing issue 5650

SomeDude lovelydear at mailmetrash.com
Wed Apr 25 01:34:38 PDT 2012


Discussion here: 
http://d.puremagic.com/issues/show_bug.cgi?id=5650

On my Windows box, the following program

import std.stdio, std.container, std.range;

void main() {
     enum int range = 100;
     enum int n = 1_000_000;

     auto t = redBlackTree!int(0);

     for (int i = 0; i < n; i++) {
         if (i > range)
             t.removeFront();
         t.insert(i);
     }

     writeln(walkLength(t[]));
     //writeln(t[]);
}

runs in about 1793 ms.
The strange thing is, if I comment out the writeln line, runtimes 
are in average *slower* by about 20 ms, with timings varying a 
little bit more than when the writeln is included.

How can this be ?


More information about the Digitalmars-d-learn mailing list