dsimcha:

> Yeah, I think it would be much more interesting (for C++ as well as D) to see
> benchmarks in idiomatic D style.  This will likely be slower than code 
> written in
> the C-like subset, as there is really not much reason why C-like D code 
> should be
> any slower than C.  However, it will give a better indication of how much the
> abstractions present in D really cost if you choose to use them.

I agree. For example D programs compiled with LDC are about as fast as C 
programs compiled with GCC if those D programs use only C features.
But essentially most D1 features that are not present in C lead to slow or very 
slow programs, when compiled with ldc (like interfaces, dynamic array appends, 
etc, etc).

Anyway, the Shootout allows you to have more than one version of the same code, 
so you can put two versions of the same D program, one high level and one lower 
level. This was a C-style version of the D k-nucleotide benchmark:
http://shootout.alioth.debian.org/debian/benchmark.php?test=knucleotide&lang=dlang&id=3
And my higher level version of the same benchmark (in this case the higher 
level is faster, but usually it's the opposite):
http://shootout.alioth.debian.org/debian/benchmark.php?test=knucleotide&lang=gdc&id=1

Bye,
bearophile

Reply via email to