www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Is there a report for performance compared with popular languarge?

reply cglee <high_volt hanmail.net> writes:
Hi,

I have used 'C' and 'jav'a for several years.
When I need speed, I used 'C'.
When I have to reduce implemetation time, I used 'java'.
In my view, D language has both merits from 'C' and 'java'.
It means that it is OOP, but it generates native binary
without VM. We already have C++ as this. But C++ makes me
more confused when I use it.

Now, I have questions about how much 'D' is fast comparing with 'java'
and how much bigger in binary size generated by 'D' comparing with
'C'.  Is there anyone has information about this?.

Thanks
cglee
Aug 11 2010
next sibling parent Kagamin <spam here.lot> writes:
cglee Wrote:

 Now, I have questions about how much 'D' is fast comparing with 'java'
 and how much bigger in binary size generated by 'D' comparing with
 'C'.  Is there anyone has information about this?.
Java has a very good optimizer, so in trivial mathematical tests java's speed is comparable with C. The problem with java is that it uses much more memory, I suppose. On Windows D links C runtime statically and D runtime takes some space too.
Aug 11 2010
prev sibling next sibling parent Pelle <pelle.mansson gmail.com> writes:
On 08/12/2010 05:26 AM, cglee wrote:
 Hi,

 I have used 'C' and 'jav'a for several years.
 When I need speed, I used 'C'.
 When I have to reduce implemetation time, I used 'java'.
 In my view, D language has both merits from 'C' and 'java'.
 It means that it is OOP, but it generates native binary
 without VM. We already have C++ as this. But C++ makes me
 more confused when I use it.

 Now, I have questions about how much 'D' is fast comparing with 'java'
 and how much bigger in binary size generated by 'D' comparing with
 'C'.  Is there anyone has information about this?.

 Thanks
 cglee
Last I looked, java is faster than D in some cases, and vice versa. D will blow up the size of executables by quite a lot, though. Due to templates and static linking of libraries, mostly.
Aug 12 2010
prev sibling next sibling parent reply bearophile <bearophileHUGS lycos.com> writes:
cglee:

 Now, I have questions about how much 'D' is fast comparing with 'java'
 and how much bigger in binary size generated by 'D' comparing with
 'C'.  Is there anyone has information about this?.
Performance comes from many different kinds of optimizations. In modern languages things as: - Partial unrolling of loops even when the number of cycles is not known at compile-time - Inlining, even in presence of virtual calls - If the code performs lot of heap activity (as Java-style code) then a significant percentage of the performance comes from the efficiency of the GC. But today the GPU is used more and more by serious number crunchers. A numerical program written in Python that implements its numerical kernels on good GPUs using PyCuda, PyopenCL, may be tens of times more efficient than average C code written for the CPU (and for numerical kernels on the CPU there is corepy). Intel says that the GPU is on average 2.5 only times faster, but in practice you need to be a Wizard to squeeze that amount of performance from very costly CPUs. If you compile D1 code with LDC you get a good performance, comparable with C or sometimes better. If you use DMD you get lower performance (usually no more than 2-3 times slower) on both FP and integer code. The D GC is not efficient enough yet, so efficient D1/D2 programs need to minimize heap activity, and use stack-allocates structs as much as possible, and avoid Java-style code. Currently D programs use less memory than Java, thanks to structs too, but as D gets a better GC, it will probably use more RAM too. With GCs there is a tradeoff between speed and amount of memory usage. D binary size is larger than C but comparable to C++ code that uses many templates, there is a constant overhead given by statically linked runtime that's bigger than the C++ one (GC, array concat, etc). The more templates you use, the bigger the binary becomes. Phobos uses templates heavily, Tango for D1 uses them less often. Bye, bearophile
Aug 12 2010
parent Walter Bright <newshound2 digitalmars.com> writes:
bearophile wrote:
 If you compile D1 code with LDC you get a good performance, comparable with C
 or sometimes better. If you use DMD you get lower performance (usually no
 more than 2-3 times slower) on both FP and integer code.
You get the *same* performance as C. Compare DMD with DMC, for example. You'll get the same results. LCC vs LDC, you'll get the same results. GCC vs GDC, same results. Comparing DMD with LCC, and GCC vs LDC, etc., tell you the difference between code generators, not between languages.
Aug 13 2010
prev sibling parent "Nick Sabalausky" <a a.a> writes:
"cglee" <high_volt hanmail.net> wrote in message 
news:i3vpkj$1mi3$1 digitalmars.com...
 Hi,

 I have used 'C' and 'jav'a for several years.
 When I need speed, I used 'C'.
 When I have to reduce implemetation time, I used 'java'.
 In my view, D language has both merits from 'C' and 'java'.
 It means that it is OOP, but it generates native binary
 without VM. We already have C++ as this. But C++ makes me
 more confused when I use it.

 Now, I have questions about how much 'D' is fast comparing with 'java'
 and how much bigger in binary size generated by 'D' comparing with
 'C'.  Is there anyone has information about this?.
http://dotnot.org/blog/archives/2008/03/10/xml-benchmarks-updated-graphs-with-rapidxml/ http://dotnot.org/blog/archives/2008/03/10/xml-benchmarks-parsequerymutateserialize/ http://dotnot.org/blog/archives/2008/03/12/why-is-dtango-so-fast-at-parsing-xml/
Aug 12 2010