Inherent code performance advantages of D over C?

Paulo Pinto pjmlp at progtools.org
Tue Dec 10 13:28:44 PST 2013


Am 10.12.2013 22:16, schrieb Adam D. Ruppe:
> On Tuesday, 10 December 2013 at 21:05:53 UTC, Walter Bright wrote:
>> At the least, it'll compile a lot faster!
>
> Small C programs compile a *lot* faster than small D programs that use
> Phobos.
>
> import std.stdio; == add half a second to your compile time.
>
> $ time dmd hellod.d
>
> real    0m0.780s # YIKES!
> user    0m0.649s
> sys     0m0.102s
>
> $ time gcc helloc.c
>
> real    0m0.148s # not bad
> user    0m0.095s
> sys     0m0.039s
>
>
> yikes, even doing printf in D is slow nowadays
>
> $ time dmd hellod.d
>
> real    0m0.290s # good but not great
> user    0m0.212s
> sys     0m0.058s
>
>
>
> Larger D programs do better, of course, at least if you compile all the
> files at once (and don't use so much CTFE that it starts thrashing the
> swap file).

Those are implementation issues, right?

--
Paulo


More information about the Digitalmars-d mailing list