gdc or ldc for faster programs?

max haughton maxhaton at gmail.com
Sat Jan 29 18:51:41 UTC 2022


On Saturday, 29 January 2022 at 18:28:06 UTC, Ali Çehreli wrote:
> On 1/29/22 10:04, Salih Dincer wrote:
>
> > Could you also try the following code with the same
> configurations?
>
> The program you posted with 2 million random values:
>
> ldc 1.9 seconds
> gdc 2.3 seconds
> dmd 2.8 seconds
>
> I understand such short tests are not definitive but to have a 
> rough idea between two programs, the last version of my program 
> that used sprintf with 2 million numbers takes less time:
>
> ldc 0.4 seconds
> gdc 0.5 seconds
> dmd 0.5 seconds
>
> (And now we know gdc can go about 7% faster with additional 
> command line switches.)
>
> Ali

You need to be compiling with PGO to test the compilers optimizer 
to the maximum. Without PGO they have to assume a fairly 
conservative flow through the code which means things like 
inlining and register allocation are effectively flying blind.



More information about the Digitalmars-d-learn mailing list