Why I chose D over Ada and Eiffel

Tyler Jameson Little beatgammit at gmail.com
Thu Aug 22 22:28:14 PDT 2013


On Thursday, 22 August 2013 at 10:34:58 UTC, John Colvin wrote:
> On Thursday, 22 August 2013 at 02:06:13 UTC, Tyler Jameson 
> Little wrote:
>> - array operations (int[] a; int[]b; auto c = a * b;)
>>  - I don't think these are automagically SIMD'd, but there's 
>> always hope =D
>
> That isn't allowed. The memory for c must be pre-allocated, and 
> the expression then becomes c[] = a[] * b[];

Oops, that was what I meant.

> Is it SIMD'd?
>
> It depends. There is a whole load of hand-written assembler for 
> simple-ish expressions on builtin types, on x86. x86_64 is only 
> supported with 32bit integer types because I haven't finished 
> writing the rest yet...
>
> However, I'm not inclined to do so at the moment as we need a 
> complete overhaul of that system anyway as it's currently a 
> monster*.  It needs to be re-implemented as a template 
> instantiated by the compiler, using core.simd. Unfortunately 
> it's not a priority for anyone right now AFAIK.

That's fine. I was under the impression that it didn't SIMD at 
all, and that SIMD only works if explicitly stated.

I assume this is something that can be done at runtime:

     int[] a = [1, 2, 3];
     int[] b = [2, 2, 2];
     auto c = a[] * b[]; // dynamically allocates on the stack; 
computes w/SIMD
     writeln(c); // prints [2, 4, 6]

I haven't yet needed this, but it would be really nice... btw, it 
seems D does not have dynamic allocation. I know C99 does, so I 
know this is technically possible. Is this something we could 
get? If so, I'll start a thread about it.

> *
> hand-written asm loops. If fully fleshed out there would be:
>   ((aligned + unaligned + legacy mmx) * (x86 + x64) + fallback 
> loop)
>   * number of supported expressions * number of different types
> of them. Then there's unrolling considerations. See 
> druntime/src/rt/arrayInt.d



More information about the Digitalmars-d mailing list