D 50% slower than C++. What I'm doing wrong?

jerro a at a.com
Sat Apr 14 20:41:54 PDT 2012


>(I have a memory of a program that took
> ~0.004s with a C/C++ version and 1s with D, and the difference 
> seemed to be just startup time for the D program.)

I have never seen anything like that. Usually the minimal time to 
run a D program is something like:

j at debian:~$ time ./hello
Hello world!

real	0m0.001s
user	0m0.000s
sys	0m0.000s


> What really amazes me is the difference between g++, DMD and 
> GDC in size of the executable binary.  100 orders of magnitude!

With GDC those flags(for gdmd):

-fdata-sections -ffunction-sections -L--gc-sections -L-l

help a lot if you want to reduce a size of executable. Besides, 
this overhead is the standard library and runtime and won't be 
much larger in larger programs.


More information about the Digitalmars-d-learn mailing list