Re: DMD is faster than LDC and GDC

2015-11-14 Thread Marc Schütz via Digitalmars-d
On Saturday, 14 November 2015 at 00:37:51 UTC, Manu wrote: In the meantime, there probably needs to be strong warnings about violating attributes, and if patterns have emerged that rely on violating such attributes, we should publish a recommended alternative. One pattern that comes to mind

Re: DMD is faster than LDC and GDC

2015-11-13 Thread Ali Çehreli via Digitalmars-d
On 11/12/2015 11:50 AM, Ali Çehreli wrote: I would love to be convinced. :) Can someone come up with a reduced example please? On 11/12/2015 03:59 AM, Daniel Kozak wrote: > for (i=0; i < 100; ++i) { > fmttable(table); > } I think what we are seeing here is more due

Re: DMD is faster than LDC and GDC

2015-11-13 Thread Vladimir Panteleev via Digitalmars-d
On Thursday, 12 November 2015 at 21:24:30 UTC, David Nadlinger wrote: On Thursday, 12 November 2015 at 21:16:25 UTC, Walter Bright wrote: [...] Oh, GCC has had similar notions as a non-standard attribute for ages, and LLVM since its inception. At least for LDC, the reason why we do not

Re: DMD is faster than LDC and GDC

2015-11-13 Thread cym13 via Digitalmars-d
On Friday, 13 November 2015 at 19:59:51 UTC, Ali Çehreli wrote: On 11/12/2015 11:50 AM, Ali Çehreli wrote: I would love to be convinced. :) Can someone come up with a reduced example please? On 11/12/2015 03:59 AM, Daniel Kozak wrote: > for (i=0; i < 100; ++i) { >

Re: DMD is faster than LDC and GDC

2015-11-13 Thread Manu via Digitalmars-d
On 13 November 2015 at 08:38, Iain Buclaw via Digitalmars-d wrote: > On 12 Nov 2015 10:25 pm, "David Nadlinger via Digitalmars-d" > wrote: >> >> On Thursday, 12 November 2015 at 21:16:25 UTC, Walter Bright wrote: >>> >>> It's more than

Re: DMD is faster than LDC and GDC

2015-11-12 Thread Ali Çehreli via Digitalmars-d
I would love to be convinced. :) Can someone come up with a reduced example please? On 11/12/2015 03:59 AM, Daniel Kozak wrote: > for (i=0; i < 100; ++i) { > fmttable(table); > } I think what we are seeing here is more due to the unused side-effect in the loop, where

Re: DMD is faster than LDC and GDC

2015-11-12 Thread John Colvin via Digitalmars-d
On Thursday, 12 November 2015 at 19:11:25 UTC, tired_eyes wrote: On Thursday, 12 November 2015 at 14:44:49 UTC, John Colvin wrote: To test the speed of fmttable itself I split fmttable and main in to different modules, made fmttable extern(C) so I could just prototype it in the main module

Re: DMD is faster than LDC and GDC

2015-11-12 Thread David Nadlinger via Digitalmars-d
On Thursday, 12 November 2015 at 21:16:25 UTC, Walter Bright wrote: It's more than that - dmd's optimizer is designed to make use of the guarantees of a pure function. Since C/C++ do not have pure functions, ldc/gdc's optimizer may not have that capability. Oh, GCC has had similar notions as

Re: DMD is faster than LDC and GDC

2015-11-12 Thread Walter Bright via Digitalmars-d
On 11/12/2015 6:44 AM, John Colvin wrote: dmd is being clever and spotting that fmttable is pure, it would be good if ldc/gdc could spot this to. It's more than that - dmd's optimizer is designed to make use of the guarantees of a pure function. Since C/C++ do not have pure functions,

Re: DMD is faster than LDC and GDC

2015-11-12 Thread rsw0x via Digitalmars-d
On Thursday, 12 November 2015 at 21:16:25 UTC, Walter Bright wrote: On 11/12/2015 6:44 AM, John Colvin wrote: dmd is being clever and spotting that fmttable is pure, it would be good if ldc/gdc could spot this to. It's more than that - dmd's optimizer is designed to make use of the

Re: DMD is faster than LDC and GDC

2015-11-12 Thread Iain Buclaw via Digitalmars-d
On 12 Nov 2015 10:25 pm, "David Nadlinger via Digitalmars-d" < digitalmars-d@puremagic.com> wrote: > > On Thursday, 12 November 2015 at 21:16:25 UTC, Walter Bright wrote: >> >> It's more than that - dmd's optimizer is designed to make use of the guarantees of a pure function. Since C/C++ do not

Re: DMD is faster than LDC and GDC

2015-11-12 Thread Iain Buclaw via Digitalmars-d
On 12 November 2015 at 12:59, Daniel Kozak via Digitalmars-d < digitalmars-d@puremagic.com> wrote: > code: > > > > GDC (-O3 -finline -frelease -fno-bounds-check): > real0m0.724s > user0m0.720s > sys 0m0.003s > > Not to be pedantic, but -finline does nothing (what you really want is

Re: DMD is faster than LDC and GDC

2015-11-12 Thread John Colvin via Digitalmars-d
On Thursday, 12 November 2015 at 11:59:50 UTC, Daniel Kozak wrote: code: import std.stdio; auto fmttable(immutable(string[][]) table) { import std.array : appender, uninitializedArray; import std.range : take, repeat; import std.exception : assumeUnique; auto res =

Re: DMD is faster than LDC and GDC

2015-11-12 Thread Daniel Kozak via Digitalmars-d
V Thu, 12 Nov 2015 13:37:28 +0100 Iain Buclaw via Digitalmars-d napsáno: > On 12 November 2015 at 12:59, Daniel Kozak via Digitalmars-d < > digitalmars-d@puremagic.com> wrote: > > > code: > > > > > > > > > > > GDC (-O3 -finline -frelease -fno-bounds-check): > >

DMD is faster than LDC and GDC

2015-11-12 Thread Daniel Kozak via Digitalmars-d
code: import std.stdio; auto fmttable(immutable(string[][]) table) { import std.array : appender, uninitializedArray; import std.range : take, repeat; import std.exception : assumeUnique; auto res = appender(uninitializedArray!(char[])(128)); res.clear(); if

Re: DMD is faster than LDC and GDC

2015-11-12 Thread Daniel Kozak via Digitalmars-d
V Thu, 12 Nov 2015 12:10:30 + John Colvin via Digitalmars-d napsáno: > On Thursday, 12 November 2015 at 11:59:50 UTC, Daniel Kozak wrote: > > code: > > > > import std.stdio; > > > > auto fmttable(immutable(string[][]) table) { > > > > import std.array :

Re: DMD is faster than LDC and GDC

2015-11-12 Thread John Colvin via Digitalmars-d
On Thursday, 12 November 2015 at 12:23:11 UTC, Daniel Kozak wrote: V Thu, 12 Nov 2015 12:10:30 + John Colvin via Digitalmars-d napsáno: On Thursday, 12 November 2015 at 11:59:50 UTC, Daniel Kozak wrote: > [...] What versions of these compilers? I suspect

Re: DMD is faster than LDC and GDC

2015-11-12 Thread John Colvin via Digitalmars-d
On Thursday, 12 November 2015 at 11:59:50 UTC, Daniel Kozak wrote: code: import std.stdio; auto fmttable(immutable(string[][]) table) { import std.array : appender, uninitializedArray; import std.range : take, repeat; import std.exception : assumeUnique; auto res =

Re: DMD is faster than LDC and GDC

2015-11-12 Thread Daniel Kozak via Digitalmars-d
V Thu, 12 Nov 2015 12:38:47 + John Colvin via Digitalmars-d napsáno: > On Thursday, 12 November 2015 at 12:23:11 UTC, Daniel Kozak wrote: > > V Thu, 12 Nov 2015 12:10:30 + > > John Colvin via Digitalmars-d > > napsáno: > > >

Re: DMD is faster than LDC and GDC

2015-11-12 Thread tired_eyes via Digitalmars-d
On Thursday, 12 November 2015 at 14:44:49 UTC, John Colvin wrote: To test the speed of fmttable itself I split fmttable and main in to different modules, made fmttable extern(C) so I could just prototype it in the main module (no import), then compiled them separately before linking. This

Re: DMD is faster than LDC and GDC

2015-11-12 Thread jmh530 via Digitalmars-d
On Thursday, 12 November 2015 at 14:44:49 UTC, John Colvin wrote: dmd is being clever and spotting that fmttable is pure, it would be good if ldc/gdc could spot this to. I don't recall seeing anything in the 2.069.0 change log about improved attribute inference for auto functions. If you

Re: DMD is faster than LDC and GDC

2015-11-12 Thread Artur Skawina via Digitalmars-d
On 11/12/15 13:22, Daniel Kozak via Digitalmars-d wrote: >>> timings: >>> > > >>> > > DMD (-O -release -inline -boundscheck=off): >>> > > real0m0.003s >>> > > user0m0.000s >>> > > sys 0m0.000s >>> > > >>> > > LDMD2-ldc2 (-O -release -inline -boundscheck=off): >>> > > real0m1.071s