D looses in speed to Common Lisp

Laeeth Isharc via Digitalmars-d digitalmars-d at puremagic.com
Mon May 11 18:20:12 PDT 2015


On Monday, 11 May 2015 at 23:32:48 UTC, Dzhon Smit wrote:

> The point was to compare the performance of nearly identical 
> pieces of code in D and in CL.  However, when I compile this 
> idiomatic sample with `dmd fib2`, I get
>
> $ time ./fib2
> 0
>
> real    0m2.226s
> user    0m2.223s
> sys     0m0.003s
>
> which is still slower.

we already know dmd doesn't produce the fastest code, and 
obviously you are not comparing languages but a complex set of 
things particularly compilers.  nobody who cares about 
performance will stick with dmd without trying alternatives (and 
these are free, readily available alternatives not special things 
you need to pay a fortune for as with some of the 'java GC can be 
realtime' guys argued indicated as having relevance to the 
commercial choice in ordinary circumstances to use java or not).

if one wanted to spend a couple hundred k bucks on rewriting the 
codegen, I am sure you would see dmd fast again, but what would 
that demonstrate about D the language?

it's fair play to compare naive code using fast compilers, but 
just like micro benchmarks, one shouldn't make more of the result 
than may be justified.  ie the real question is in practical use 
cases (bearing in mind you are going to pick one or two languages 
and stick with them, figuring out the tricks with experience), 
given reasonable effort, what is relative performance like?  and 
I doubt anyone is going to not use D because "it's slower than 
common lisp".

what I have read of the facebook experience (although hardly a 
controlled experiment by a neutral observer) is intriguing from 
that perspective.


More information about the Digitalmars-d mailing list