Thread overview | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
April 25, 2012 Strange measurements when reproducing issue 5650 | ||||
---|---|---|---|---|
| ||||
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 ? |
April 25, 2012 Re: Strange measurements when reproducing issue 5650 | ||||
---|---|---|---|---|
| ||||
Posted in reply to SomeDude | On Wednesday, 25 April 2012 at 08:34:40 UTC, SomeDude wrote: Noone reproduces this ? |
April 25, 2012 Re: Strange measurements when reproducing issue 5650 | ||||
---|---|---|---|---|
| ||||
Posted in reply to SomeDude | Dne 25.4.2012 13:27, SomeDude napsal(a):
> On Wednesday, 25 April 2012 at 08:34:40 UTC, SomeDude wrote:
>
> Noone reproduces this ?
Linux uriel 2.6.32-5-amd64 #1 SMP Wed Jan 12 03:40:32 UTC 2011 x86_64 GNU/Linux
DMD64 D Compiler v2.058
Commented writeln on average (10 runs) 40 ms slower.
So yes, it happens to me as well.
Martin
|
April 25, 2012 Re: Strange measurements when reproducing issue 5650 | ||||
---|---|---|---|---|
| ||||
Posted in reply to SomeDude | 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?
|
April 25, 2012 Re: Strange measurements when reproducing issue 5650 | ||||
---|---|---|---|---|
| ||||
Posted in reply to SomeDude | On Wed, 25 Apr 2012 07:27:29 -0400, SomeDude <lovelydear@mailmetrash.com> wrote:
> On Wednesday, 25 April 2012 at 08:34:40 UTC, SomeDude wrote:
>
> Noone reproduces this ?
On my linux box, it runs in about 580ms, with or without the writeln.
This is what I would expect.
But things can be strange when dealing with GC timings. Have you tried profiling the code to see where the time is being added?
-Steve
|
April 25, 2012 Re: Strange measurements when reproducing issue 5650 | ||||
---|---|---|---|---|
| ||||
Posted in reply to SomeDude | Am Wed, 25 Apr 2012 10:34:38 +0200 schrieb "SomeDude" <lovelydear@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 |
April 25, 2012 Re: Strange measurements when reproducing issue 5650 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Wednesday, 25 April 2012 at 15:35:44 UTC, Steven Schveighoffer wrote:
> On Wed, 25 Apr 2012 07:27:29 -0400, SomeDude <lovelydear@mailmetrash.com> wrote:
>
>> On Wednesday, 25 April 2012 at 08:34:40 UTC, SomeDude wrote:
>>
>> Noone reproduces this ?
>
> On my linux box, it runs in about 580ms, with or without the writeln.
>
> This is what I would expect.
>
> But things can be strange when dealing with GC timings. Have you tried profiling the code to see where the time is being added?
>
> -Steve
Did you compile with dmd -O -inline -release ?
I'll do some profiling later.
|
April 25, 2012 Re: Strange measurements when reproducing issue 5650 | ||||
---|---|---|---|---|
| ||||
Posted in reply to SomeDude | On Wednesday, 25 April 2012 at 17:06:00 UTC, SomeDude wrote:
> On Wednesday, 25 April 2012 at 15:35:44 UTC, Steven Schveighoffer wrote:
>> On Wed, 25 Apr 2012 07:27:29 -0400, SomeDude <lovelydear@mailmetrash.com> wrote:
>>
>>> On Wednesday, 25 April 2012 at 08:34:40 UTC, SomeDude wrote:
>>>
>>> Noone reproduces this ?
>>
>> On my linux box, it runs in about 580ms, with or without the writeln.
>>
>> This is what I would expect.
>>
>> But things can be strange when dealing with GC timings. Have you tried profiling the code to see where the time is being added?
>>
>> -Steve
>
> Did you compile with dmd -O -inline -release ?
>
> I'll do some profiling later.
OK, I'm having a hard time producing data that support what I see without profiling on, but it's still quite consistent accross runs. I dunno what's wrong here.
|
April 25, 2012 Re: Strange measurements when reproducing issue 5650 | ||||
---|---|---|---|---|
| ||||
Posted in reply to SomeDude | On Wed, 25 Apr 2012 13:05:59 -0400, SomeDude <lovelydear@mailmetrash.com> wrote:
> On Wednesday, 25 April 2012 at 15:35:44 UTC, Steven Schveighoffer wrote:
>> On Wed, 25 Apr 2012 07:27:29 -0400, SomeDude <lovelydear@mailmetrash.com> wrote:
>>
>>> On Wednesday, 25 April 2012 at 08:34:40 UTC, SomeDude wrote:
>>>
>>> Noone reproduces this ?
>>
>> On my linux box, it runs in about 580ms, with or without the writeln.
>>
>> This is what I would expect.
>>
>> But things can be strange when dealing with GC timings. Have you tried profiling the code to see where the time is being added?
>>
>> -Steve
>
> Did you compile with dmd -O -inline -release ?
Yes.
-Steve
|
April 25, 2012 Re: Strange measurements when reproducing issue 5650 | ||||
---|---|---|---|---|
| ||||
Posted in reply to SomeDude | Al 25/04/12 13:27, En/na SomeDude ha escrit: > On Wednesday, 25 April 2012 at 08:34:40 UTC, SomeDude wrote: > > Noone reproduces this ? > My results in Linux: 32-bit executable: About 574ms, with or without writeln. 64-bit executable: About 798ms, with or without writeln. -- Jordi Sayol |
Copyright © 1999-2021 by the D Language Foundation