Strange measurements when reproducing issue 5650

Don Clugston dac at nospam.com
Wed Apr 25 07:43:47 PDT 2012


On 25/04/12 10:34, SomeDude wrote:
> 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 ?

Very strange.
Maybe there is some std library cleanup which is slower if nothing got 
written?


More information about the Digitalmars-d-learn mailing list