D for the Win

Mike via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sun Aug 24 06:44:07 PDT 2014


On Sunday, 24 August 2014 at 13:13:58 UTC, ketmar via 
Digitalmars-d-announce wrote:
> On Sun, 24 Aug 2014 12:51:10 +0000
> Mike via Digitalmars-d-announce 
> <digitalmars-d-announce at puremagic.com>
> wrote:
>
> ps.
>> 6. This change 
>> (https://github.com/nsf/pnoise/commit/baadfe20c7ae6aa900cb0e4188aa9d20bea95918)
>
> with GDC has no effect at all.

If I undo all of Edmund Smith's changes from today, use C's 
floor, and remove all the excessive function attributes, I get 
this

http://dpaste.dzfl.pl/1b564efb423e
=== gcc -O3:
        0.141484117 seconds time
=== D (dmd):
        0.446634464 seconds time
=== D (ldc2):
        0.191059330 seconds time
=== D (gdc):
        0.226455762 seconds time


Then I add change only #6 above, and remove the excessive 
function attributes, I get this:
http://dpaste.dzfl.pl/f525adab909c
=== gcc -O3:
        0.137815809 seconds time
=== D (dmd):
        0.480525196 seconds time
=== D (ldc2):
        0.139659135 seconds time
=== D (gdc):
        0.131637220 seconds time

Approaching twice as fast for GDC.  That's significant to me.

Also, all those optimization flags should already be on with -O3. 
  Here are the flags I'm using:

gcc -std=c99 -O3 -o bin_test_c_gcc test.c -lm
dmd -ofbin_test_d_dmd -O -noboundscheck -inline -release test.d
ldc2 -O3 -ofbin_test_d_ldc test.d -release
gdc -O3 -o bin_test_d_gdc test.d -frelease

Maybe I'll make a pull request for it.  I don't think users 
should have to decorate their code like a Christmas tree and use 
a bunch of special compiler flags to get a well-behaved binary.

Mike


More information about the Digitalmars-d-announce mailing list