C++17 cannot beat D surely
rikki cattermole via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jun 4 03:21:16 PDT 2017
On 04/06/2017 11:06 AM, Vittorio Romeo wrote:
> Could someone clarify why the generated assembly for
>
> void main() @nogc {
> import std.algorithm;
> enum a = [3, 1, 2, 0]; // inferred to be int[]
> enum b = sort(a);
> static assert(b[0] == 0);
> }
>
> is 1380 lines with ldc 1.3.0 (-O3 -release -betterC -flto=full)?
> You can see the result on godbolt here:
> https://godbolt.org/g/BNRnO9
>
> It's kind of surprising compared to C++'s 2 lines:
> https://godbolt.org/g/vXrxaY
_Dmain is exactly 2 instructions, so nope equivalent :)
The linker isn't stripping out unused symbols however (from what I can
tell).
More information about the Digitalmars-d
mailing list