Inherent code performance advantages of D over C?

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Mon Dec 9 23:28:14 PST 2013


On 09/12/13 20:45, Araq wrote:
> That language X is faster than C in "practice" because X is much more developer
> friendly and thus you can tweak your code much easier etc. is an argument of
> every language out there.

Yes, but most languages (certainly most "friendly" ones) do not allow you to 
drill down into the details in the way that D does.

The claim that's made for most languages in my experience is that, sure, the 
language is ultimately slower, but the developer time saved is worth more than 
the performance hit, and if you ever _really_ need to gain that extra 
performance, you can always drop down into C.  Of course, that assumption 
doesn't hold for some domains (e.g. intensive scientific simulation, games...) 
which is why C/C++ still has a significant presence there.

By contrast with D you get all that friendliness of refactoring and redesigning 
and extra time to experiment with alternatives, but in a language which is 
speed-wise on a par with C anyway; and if its higher-level constructs cause any 
problems, you can drill down to micro-management of your program _while still 
writing in D_.  That's why D is very useful for heavy-duty scientific simulation 
and why unlike most other friendly languages it's a genuine contender for games 
programming.


More information about the Digitalmars-d mailing list