www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - D has now surpassed C++ in overall performance

reply John <kmk200us yahoo.com> writes:
D has now surpassed C++ in overall performance at the "Computer Language
Shootout" website. This change came about with the upgrade to 1.004 from 1.000
(I'm guessing because of the new GC).   

http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all&calc=Calculate&xfullcpu=1&xmem=1&xloc=0&binarytrees=1&chameneos=1&message=1&fannkuch=1&fasta=1&knucleotide=1&mandelbrot=1&meteor=0&nbody=1&nsieve=1&nsievebits=1&partialsums=1&pidigits=1&recursive=1&regexdna=1&revcomp=1&spectralnorm=1&hello=0&sumcol=1
Feb 01 2007
next sibling parent Anders Runesson <anders runesson.info> writes:
John skrev:
 D has now surpassed C++ in overall performance at the "Computer Language
Shootout" website. This change came about with the upgrade to 1.004 from 1.000
(I'm guessing because of the new GC).   
 
 http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all&calc=Calculate&xfullcpu=1&xmem=1&xloc=0&binarytrees=1&chameneos=1&message=1&fannkuch=1&fasta=1&knucleotide=1&mandelbrot=1&meteor=0&nbody=1&nsieve=1&nsievebits=1&partialsums=1&pidigits=1&recursive=1&regexdna=1&revcomp=1&spectralnorm=1&hello=0&sumcol=1
Nice. Then again, neither intel nor microsoft's compilers were in the shootout. Would have been interesting to see.
Feb 01 2007
prev sibling next sibling parent reply Andreas Kochenburger <akk nospam.org> writes:
John schrieb:
 D has now surpassed C++ in overall performance at the "Computer Language
Shootout" website. This change came about with the upgrade to 1.004 from 1.000
(I'm guessing because of the new GC).   
 
 http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all&calc=Calculate&xfullcpu=1&xmem=1&xloc=0&binarytrees=1&chameneos=1&message=1&fannkuch=1&fasta=1&knucleotide=1&mandelbrot=1&meteor=0&nbody=1&nsieve=1&nsievebits=1&partialsums=1&pidigits=1&recursive=1&regexdna=1&revcomp=1&spectralnorm=1&hello=0&sumcol=1
The shootout is a fun project. IMO the results depend too much on the enthusiasts who participate and continue optimizing algorithms in their favourite language. BigForth and the meteor benchmark is just a recent example. And the expressiveness of a language isn't even a criterion!
Feb 01 2007
parent janderson <askme me.com> writes:
Andreas Kochenburger wrote:
 John schrieb:
 D has now surpassed C++ in overall performance at the "Computer 
 Language Shootout" website. This change came about with the upgrade to 
 1.004 from 1.000 (I'm guessing because of the new GC).  
 http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all&calc=Calculate&xfullcpu=1&xmem=1&xloc=0&binarytrees=1&chameneos=1&message=1&fannkuch=1&fasta=1&knucleotide=1&mandelbrot=1&meteor=0&nbody=1&nsieve=1&nsievebits=1&partialsums=1&pidigits=1&recursive=1&regexdna=1&revcomp=1&spectralnor
=1&hello=0&sumcol=1 
The shootout is a fun project. IMO the results depend too much on the enthusiasts who participate and continue optimizing algorithms in their favourite language. BigForth and the meteor benchmark is just a recent example. And the expressiveness of a language isn't even a criterion!
I find the D and C++ the most interesting because the code is almost the same in most cases (at least in the examples). Of course both languages could implement C versions of the algorithms to get the top level of performance. -Joel
Feb 01 2007
prev sibling next sibling parent reply janderson <askme me.com> writes:
John wrote:
 D has now surpassed C++ in overall performance at the "Computer Language
Shootout" website. This change came about with the upgrade to 1.004 from 1.000
(I'm guessing because of the new GC).   
 
 http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all&calc=Calculate&xfullcpu=1&xmem=1&xloc=0&binarytrees=1&chameneos=1&message=1&fannkuch=1&fasta=1&knucleotide=1&mandelbrot=1&meteor=0&nbody=1&nsieve=1&nsievebits=1&partialsums=1&pidigits=1&recursive=1&regexdna=1&revcomp=1&spectralnorm=1&hello=0&sumcol=1
Only if you take memory into account. CPU performance is still not up to par. The recursive and the mandelbrot are the biggest performance eaters. Recursive is the same as gcc so it must be a compiler thing I guess. -Joel
Feb 01 2007
next sibling parent reply John <kmk200us yahoo.com> writes:
janderson Wrote:

 John wrote:
 D has now surpassed C++ in overall performance at the "Computer Language
Shootout" website. This change came about with the upgrade to 1.004 from 1.000
(I'm guessing because of the new GC).   
 
 http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all&calc=Calculate&xfullcpu=1&xmem=1&xloc=0&binarytrees=1&chameneos=1&message=1&fannkuch=1&fasta=1&knucleotide=1&mandelbrot=1&meteor=0&nbody=1&nsieve=1&nsievebits=1&partialsums=1&pidigits=1&recursive=1&regexdna=1&revcomp=1&spectralnorm=1&hello=0&sumcol=1
Only if you take memory into account. CPU performance is still not up to par. The recursive and the mandelbrot are the biggest performance eaters. Recursive is the same as gcc so it must be a compiler thing I guess. -Joel
Yeah, I would really like to see GDC added but they said it would be "too difficult" to install.
Feb 01 2007
next sibling parent janderson <askme me.com> writes:
John wrote:
 
 Yeah, I would really like to see GDC added but they said it would be "too
difficult" to install.
Yeah, this would be a better benchmark (never perfect of course) of the difference the language syntax itself makes to performance.
Feb 02 2007
prev sibling parent Georg Wrede <georg nospam.org> writes:
John wrote:
 janderson Wrote:
 John wrote:
 
 D has now surpassed C++ in overall performance at the "Computer
 Language Shootout" website. This change came about with the
 upgrade to 1.004 from 1.000 (I'm guessing because of the new GC).
 
 http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all&calc=Calculate&xfullcpu=1&xmem=1&xloc=0&binarytrees=1&chameneos=1&message=1&fannkuch=1&fasta=1&knucleotide=1&mandelbrot=1&meteor=0&nbody=1&nsieve=1&nsievebits=1&partialsums=1&pidigits=1&recursive=1&regexdna=1&revcomp=1&spectralnorm=1&hello=0&sumcol=1
Only if you take memory into account. CPU performance is still not up to par. The recursive and the mandelbrot are the biggest performance eaters. Recursive is the same as gcc so it must be a compiler thing I guess.
Yeah, I would really like to see GDC added but they said it would be "too difficult" to install.
Now this _is_ to worry about. The Shootout guys never purported to be Universal Gurus, but they're sure as heck no first-timers either. And if that kind of folks are, er, un-eager to install GDC, then something really ought to change. And before anybody pushes the Reply button, I've got things: - I know from beforehand what some Nordic Guys would say -- so don't. - Yes, there are RPMs for a gazillion Linux versions (sorry, Richard (M.S.) hit me with a memory stick: I mean _GNU_ [whatever] Versions) (( who said communism excludes imperialism???)), and there are other ready-to-use packages for other Linuxes, and even source distros. And (this really being the point: ) whatever we have or don't have, is secondary to the "user experience". Meaning, if folks perceive this as "difficult", then - I've always felt embarrassed because I felt "it too difficult to bother". I'm starting to suspect I'm not alone, alone, alone...... - Some (most?) of those who have GDC installed (and the next version installed and t.n.v. installed...), have probably gotten so used to the install procedure that they actually don't perceive it as cumbersome and/or difficult anymore. (You only count if you've got your GCC intact and usable at will!) I've nothing against GDC, its installing procedure or anything. My point is only that people who are used to it may not anymore be in a position to appreciate how daunting a ( _GDC_ ) newcomer (as opposed to D newcomer in general) might perceive the job of (finding out the procedure in the first place, and) downloading the appropriate file(s), checking out (from some authority on GDC stuff) whether ( /this/ ) GDC will fu... crap up their ( /this/ ) GCC installation (and if so, should they consider this as a once-only inconvenience or prepare for it as a fact of life?), etc, etc...
Feb 04 2007
prev sibling parent reply Knud Soerensen <4tuu4k002 sneakemail.com> writes:
On Thu, 01 Feb 2007 18:30:55 -0800, janderson wrote:

 John wrote:
 D has now surpassed C++ in overall performance at the "Computer Language
Shootout" website. This change came about with the upgrade to 1.004 from 1.000
(I'm guessing because of the new GC).   
 
 http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all&calc=Calculate&xfullcpu=1&xmem=1&xloc=0&binarytrees=1&chameneos=1&message=1&fannkuch=1&fasta=1&knucleotide=1&mandelbrot=1&meteor=0&nbody=1&nsieve=1&nsievebits=1&partialsums=1&pidigits=1&recursive=1&regexdna=1&revcomp=1&spectralnorm=1&hello=0&sumcol=1
Only if you take memory into account. CPU performance is still not up to par. The recursive and the mandelbrot are the biggest performance eaters. Recursive is the same as gcc so it must be a compiler thing I guess. -Joel
Well the gcc mandelbrot use sse commands for fast computations maybe when D get vectorization this will change. I noticed that gcc recursive uses template < class N > N Fib(N n) { return __builtin_expect(n < 2, 0) ? 1 : Fib(n - 2) + Fib(n - 1); } while D uses template Fib(T) { T Fib(T n) { if(n < 2) return 1; else return Fib(n-2) + Fib(n-1); } } I remember a while back I notice that there is a speed difference between using x<y ? a:b; and using if (x<y) a; else b; maybe they are not optimized the same way ??? Knud
Feb 02 2007
next sibling parent janderson <askme me.com> writes:
Knud Soerensen wrote:
 On Thu, 01 Feb 2007 18:30:55 -0800, janderson wrote:
 
 John wrote:
 D has now surpassed C++ in overall performance at the "Computer Language
Shootout" website. This change came about with the upgrade to 1.004 from 1.000
(I'm guessing because of the new GC).   

 http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all&calc=Calculate&xfullcpu=1&xmem=1&xloc=0&binarytrees=1&chameneos=1&message=1&fannkuch=1&fasta=1&knucleotide=1&mandelbrot=1&meteor=0&nbody=1&nsieve=1&nsievebits=1&partialsums=1&pidigits=1&recursive=1&regexdna=1&revcomp=1&spectralnorm=1&hello=0&sumcol=1
Only if you take memory into account. CPU performance is still not up to par. The recursive and the mandelbrot are the biggest performance eaters. Recursive is the same as gcc so it must be a compiler thing I guess. -Joel
Well the gcc mandelbrot use sse commands for fast computations maybe when D get vectorization this will change. I noticed that gcc recursive uses template < class N > N Fib(N n) { return __builtin_expect(n < 2, 0) ? 1 : Fib(n - 2) + Fib(n - 1); }
I would argue that that shouldn't be allowed.
 while D uses
 template Fib(T)
 {
     T Fib(T n)
     {
         if(n < 2) return 1;
         else return Fib(n-2) + Fib(n-1);
     }
 }
 
 I remember a while back I notice that there is a speed difference 
 between using x<y ? a:b; and using if (x<y) a; else b; 
 maybe they are not optimized the same way ???
Good point. It should be something optimized by the compiler.
Feb 02 2007
prev sibling parent Deewiant <deewiant.doesnotlike.spam gmail.com> writes:
Knud Soerensen wrote:
 I remember a while back I notice that there is a speed difference 
 between using x<y ? a:b; and using if (x<y) a; else b; 
 maybe they are not optimized the same way ???
 
 Knud
I tested both, and it seemed that the ternary operator (?:) was a bit slower than the if/else. I just ran the recursive benchmark a few times, and using the ternary operator resulted in about 0.3 seconds slower run times (about 5.0 seconds versus about 5.3 seconds). -- Remove ".doesnotlike.spam" from the mail address.
Feb 02 2007
prev sibling parent reply Walter Bright <newshound digitalmars.com> writes:
John wrote:
 This change came about with the upgrade to 1.004 from 1.000
 (I'm guessing because of the new GC).
The NRVO has a significant effect, as well as the tail recursion optimizations added.
Feb 02 2007
parent janderson <askme me.com> writes:
Walter Bright wrote:
 John wrote:
 This change came about with the upgrade to 1.004 from 1.000
> (I'm guessing because of the new GC). The NRVO has a significant effect, as well as the tail recursion optimizations added.
Great job on the optimizations! C++ users have even less of an argument for using the language. A couple of cases even shows that the GC (which is the common complaint) performs better then C++ for those particular programs. -Joel
Feb 02 2007