Inexplicable LDC vs GDC speed difference

Johannes Pfau nospam at example.com
Tue Feb 19 00:34:51 PST 2013


Am Thu, 14 Feb 2013 01:18:21 +0100
schrieb "jerro" <a at a.com>:

> On Wednesday, 13 February 2013 at 15:07:04 UTC, Joseph Rushton 
> Wakeling wrote:	
> 
> Here's reduced code that gives the same error when always_inline 
> is added to bar:
> 
> int bar()(int x)
> {
>      if (x)
>          return 0;
> 
>      return 1;
> }
> 
> int foo(int a)
> {
>      return bar( a);
> }
> 
> bar can be inlined if I remove the first pair of parentheses (so 
> that it isn't a template).

https://github.com/D-Programming-GDC/GDC/pull/50


> 
> struct S
> {
>      int bar(const S s)
>      {
>          return 0;
>      }
> }
> 
> int foo()
> {
>      S s;
>      return s.bar(s);
> }
> 
> bar can be inlined if I remove const.
> 
> I have compiled all the samples with -c -O3 -finline-functions 
> -frelease.

I posted this to our bugzilla, I'm not sure if I'll have the time to
look at this one.

http://gdcproject.org/bugzilla/show_bug.cgi?id=37


More information about the D.gnu mailing list