Unclear about the benefits of D over C++ and Java

welkam via Digitalmars-d digitalmars-d at puremagic.com
Tue Jan 5 04:37:59 PST 2016


On Saturday, 2 January 2016 at 11:31:24 UTC, Dibyendu Majumdar 
wrote:
> * Do D compilers generate more efficient code compared to C++ 
> compilers? Are there performance benchmarks comparing D 
> implementation against C and C++?
>
> * Can D generics do everything C++ templates can (are they 
> Turing complete for instance) - and what additional 
> capabilities does D have that would make a significant 
> difference to the way templates are used in C++?
>
> * How does D's performance compare with Java when it comes to 
> concurrent applications or garbage collection?
>
> * How stable is D? Can one use it without fear that the next 
> version will significantly change the language and therefore 
> one would have to rewrite?
>
> I feel that the D website could do more to explain why someone 
> should move from C++ or Java to D - and this has to be 
> explained in terms of real world benefits in terms of:
>
> * Performance
> * Quality of implementation
>
> For someone like me - cool language features don't count that 
> much unless they lead to real world benefits.
>
> My post here was triggered after watching a video by Andrei 
> where he talked about how D generics are different from C++ 
> templates - I think stuff like that needs to be explained in 
> the front page of D website.
>
> Regards
> Dibyendu
>
> http://ravilang.org
> http://simpledbm.org

>Are there performance benchmarks comparing D
> implementation against C and C++?

C style D code will run the same as C style C++ code and a C 
style C code because they all compile to the same machine code. 
There will be differences if you use higher level language 
features, but then you are trading performance for convenience 
and its up to you to decide if that trade off is worth it.

Also keep in mind that D compilers do not apply all possible 
optimisation and your code next year my become faster.

> * How does D's performance compare with Java when it comes to 
> concurrent applications or garbage collection?

In this world there are two options:
1. You build language around GC sacrificing flexibility and 
performance if you dont use GC.
2. Or you add simple GC.

D went with second option. D`s GC will never be as good as Java, 
C# or GO because it requires language change, but D can be used 
without GC and reach C level of performance.



You asked a lot about language performance, but application 
performance is mostly dependant on code you write and not the 
language you use. Benchmarking and tuning your code will give way 
more performance than changing languages.


More information about the Digitalmars-d mailing list