Am Wed, 25 Apr 2012 10:34:38 +0200 schrieb "SomeDude" <lovelyd...@mailmetrash.com>:
> 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 ? GDC (using DMD 2.057) Linux 64-bit, Core 2 Duo @ 2 Ghz ----------------+------------------- without writeln | with writeln 3.150 s | 3.146 s .. 3,195 s Besides the fact that my rig seems to be a bit dated, I can't reproduce what you see. Only that the writeln makes the timing less accurate. -- Marco