Inherent code performance advantages of D over C?

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Sat Dec 7 01:58:52 PST 2013


On 07/12/13 09:41, Walter Bright wrote:
> For another, how many times have you seen bubble sort reimplemented in C code?
> How about the obvious implementation of string searching? etc.? I've seen that
> stuff a lot. But in D, using a best-of-breed implementation of quicksort is easy
> as pie, same with searching, etc. These kinds of things also make D faster. I've
> translated C code into D before and gotten it to run faster by doing these sorts
> of plug-in algorithm replacements.

Conversely, where it seems necessary, it's always possible to write D code in a 
"C-like", very detailed imperative style that really takes micro control of how 
something is implemented.  However, that can usually be hidden away inside a 
function so that the end user doesn't need to be bothered by it.

With C you're pretty much obliged to write complicated code in many situations. 
  With D, even where you need to write like this it's usually _less_ complicated 
(less boilerplate etc.) and you only have to break it out where it's really, 
really necessary.


More information about the Digitalmars-d mailing list