Inherent code performance advantages of D over C?

Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com> Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com>
Mon Dec 16 11:08:48 PST 2013


On Monday, 16 December 2013 at 18:20:23 UTC, Andrei Alexandrescu 
wrote:
> Nonsense. Using extralinguistic tools including code generators 
> is not the exclusive appurtenance of C.

Not sure what you mean is nonsense. In general, having to resort 
to macros and source-generating tools have been seen as a 
weakness of the semantics of the language. In most dynamic 
languages you never have to do that (because you can eval()). 
However, the Unix/C philosophy has always been that of having a 
conglomerate of smaller programs to build larger systems. It is 
not a "quick fix", it is in line with the basic philosophy of 
having many simple tools. Hence it is idiomatic.

When you reach the complexity of C++/D you really should not be 
required to resort to such techniques. C is a simple language 
that used to have simple compilers.

> And m4, more powerful and supposedly better, has only spawned 
> more madness.

m4 is quite powerful, but macro-processors are annoying, if that 
is what you are implying. I've only used m4 to address 
limitations in more limited languages.

> Current applications also demand good modeling power. The days 
> when one thousand lines was a nontrivial program are behind us. 
> The right solution is a language that combines performance 
> control with the modeling required by large applications.

M… There are two schools of object-orientation: that of object 
oriented design/modelling and that of object oriented 
programming. If you don't skip the modelling part you can write 
OO in most languages. Many programmers skip the modelling part 
and think that doing OOP is sufficient. It is isn't. OOP is about 
ADTs. OOD is about the understanding the domain, where you need 
flexibility in the future etc, the language is not the most 
important aspect of getting good structure. You can probably do a 
good job even in PHP (which is a very crappy language) if your 
analysis of the domain is good.

If you want more modelling power you should look at Beta, 
Datalog/Prolog etc… D doesn't provide more modelling power than 
other imperative OO languages. Does it? Are the objects nested 
like in Beta? Do you have the ability to do virtual inheritance 
on classes? Do you have the ability to extend virtual functions 
by calling the sub-class from the superclass (inner-statements 
rather than outer, so that you can enforce transactional 
BEGIN/END clauses?)

But that was not my point. My point was that performance on the 
CPU is going to be less important because it account for only 10% 
of the total performance. GPUs now do TerraFLOPs. FPGAS are being 
packaged with CPUs by Zynq, OpenCL will be able to compile to 
FPGAs. So basically, to get performance the language should 
support more than just the CPU and that is not easy because of 
the potential bottlenecks between the subsystems.


More information about the Digitalmars-d mailing list