A little benchmark in D and C

David Nadlinger via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Fri Jul 4 08:55:49 PDT 2014


On Friday, 4 July 2014 at 15:40:26 UTC, bearophile wrote:
> Through Reddit I've found a little benchmark. Here there is a D 
> version, followed by a C99 version.
>
> I compile with:
> ldmd2 -O -release -inline -noboundscheck test1.d
> gcc -O3 -std=c99 test2.c -o test2
>
> […]

A quick test suggests that this seems to be a matter of GCC's 
optimizer picking up on something that LLVM's doesn't, as Clang 
3.4.2 produces an executable just as slow/fast than that by LDC 
built against LLVM 3.4.2.

Would be interesting to look at the asm to see what is going on 
here.

David


More information about the digitalmars-d-ldc mailing list