Inherent code performance advantages of D over C?

qznc qznc at web.de
Sat Dec 7 00:13:23 PST 2013


On Friday, 6 December 2013 at 22:20:19 UTC, Walter Bright wrote:
> "there is no way proper C code can be slower than those 
> languages."
> http://www.reddit.com/r/programming/comments/1s5ze3/benchmarking_d_vs_go_vs_erlang_vs_c_for_mqtt/cduwwoy
>
> comes up now and then. I think it's incorrect, D has many 
> inherent advantages in generating code over C:

Good choice of words. The competent C programmer is able to 
perform comparable optimizations at least in the hot spots. D 
gives you a few of those for free (garbage collection,slices) and 
makes some things significantly easier (templates).

However, I think the original statement is also true in the 
technical sense. The same argument can be made with assembly. It 
is impossible to beat "proper" hand-written asm, where proper 
means "only theoretically possible". In practice I agree with you 
that optimizing a D program should be easier than optimizing a C 
program.


More information about the Digitalmars-d mailing list