[Bench!][Mir] +54%..+185% performance boost for Mersenne Twister.

Joseph Rushton Wakeling via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 8 05:43:04 PST 2017


On Sunday, 8 January 2017 at 13:16:29 UTC, Joseph Rushton 
Wakeling wrote:
> I'm asking for eyes on the problem because reducing it to a 
> minimal example appears non-trivial, while the bug itself looks 
> serious beyond its effect on this PR.

I underestimated myself :-P  Minimal example is as follows:

/////////////////////////////////////////////////////////////////
struct Inner
{
     uint value = void;  // <=== removing this `void` initializer
                         // removes the problem
}

struct Outer
{
     Inner inner = defaultInner();

     static Inner defaultInner()
     {
         if (!__ctfe) assert(false);
         Inner inn;
         inn.value = 23;
         return inn;
     }
}

void main()
{
     import std.stdio : writeln;
     Outer outer;
     outer.inner.writeln;  // outputs `Inner(0)` with dmd
                           // but should be `Inner(23)`
                           // ldc gets it right ;-)
}
/////////////////////////////////////////////////////////////////

So, the bug comes down to priority of default initialization.  
I'll follow an issue later today and fix the PR accordingly.


More information about the Digitalmars-d mailing list