Thread overview
New benchmark results
Oct 09, 2004
Walter
Oct 09, 2004
Sean Kelly
Oct 09, 2004
Sean Kelly
Oct 10, 2004
Ben Hinkle
Oct 10, 2004
Walter
how about Shootout ? Re: New benchmark results
Oct 10, 2004
some
Oct 10, 2004
Walter
October 09, 2004
Over in comp.lang.c++.moderated it was suggested that I'd castrated C++ or hobbled the DMC++ compiler in order to get the benchmark results in www.digitalmars.com/d/cppstrings.html. Since the conventional wisdom is that C++ using STL can't be beat for efficiency, I can understand their skepticism. I'd be skeptical too.

So David Friedman has stepped in to compare his excellent gdc compiler with g++, where the compilers also share a common optimizer and code generator. As everyone can see on the updated web page, the results are comparable. D runs away with the win by any measure.

Many thanks to David!


October 09, 2004
Walter wrote:
> Over in comp.lang.c++.moderated it was suggested that I'd castrated C++ or
> hobbled the DMC++ compiler in order to get the benchmark results in
> www.digitalmars.com/d/cppstrings.html. Since the conventional wisdom is that
> C++ using STL can't be beat for efficiency, I can understand their
> skepticism. I'd be skeptical too.
> 
> So David Friedman has stepped in to compare his excellent gdc compiler with
> g++, where the compilers also share a common optimizer and code generator.
> As everyone can see on the updated web page, the results are comparable. D
> runs away with the win by any measure.

FWIW, I decided to run my own benchmarks using DMC (with STLPort) and DMD.  I tried the default code plus a quick hack of the C++ version to dump everything in a stringstream before parsing.  Here are my results:

D:

Execution time: 0.077 s
Execution time: 0.071 s
Execution time: 0.079 s

CPP 1 (original):

Execution time: 0.136 s
Execution time: 0.125 s
Execution time: 0.132 s

CPP 2 (stringstream version):

Execution time: 0.146 s
Execution time: 0.155 s
Execution time: 0.157 s

This does seem a fair test of the code the average person is likely to write using each language.  I know each could be optimized, but doing so would require some skill and/or nonstandard library code.  A refcounting string and a hashmap would be the obvious improvements for C++, but while the hashmap will soon be part of the standard, there is a lot of contention over whether a refcounting version of basic_string could ever be standard-compliant.  If I have the time I'll see about using STLPort's hashmap (I'm pretty sure it has one) to flatten the differences a bit.


Sean
October 09, 2004
Sean Kelly wrote:
> If I have the time I'll see about using STLPort's hashmap (I'm pretty sure it has one) to flatten the differences a bit.

Well that turned out to be easier than I thought.  I just replaced "map" with "hash_map" and included the appropriate header file.  Here are the results:

CPP 3 (with hash_map):

Execution time: 0.102 s
Execution time: 0.110 s
Execution time: 0.102 s

So D is still the clear winner.


Sean
October 10, 2004
"Sean Kelly" <sean@f4.ca> wrote in message news:ck9qcp$1a5s$1@digitaldaemon.com...
> Sean Kelly wrote:
> > If I have the time I'll see about using
> > STLPort's hashmap (I'm pretty sure it has one) to flatten the
> > differences a bit.
>
> Well that turned out to be easier than I thought.  I just replaced "map" with "hash_map" and included the appropriate header file.  Here are the results:
>
> CPP 3 (with hash_map):
>
> Execution time: 0.102 s
> Execution time: 0.110 s
> Execution time: 0.102 s
>
> So D is still the clear winner.
>
>
> Sean

It would be interesting to also rehash the assoc array in the D code and see if that speeds up anything. Also it would be neat to pre-allocate the hash table so that the array is faster to define, too.


October 10, 2004
"Sean Kelly" <sean@f4.ca> wrote in message news:ck9q0a$1a0u$1@digitaldaemon.com...
> This does seem a fair test of the code the average person is likely to write using each language.  I know each could be optimized, but doing so would require some skill and/or nonstandard library code.

And that's part of the point. Both the D and C++ versions are straightforward implementations using the standard features of each language. Both languages offer the ability to supertune the source, etc., but I don't think that would produce any useful information as few are ever likely to write such code.


October 10, 2004
How about implement all the tests on the "The Great Computer Language Shootout" web-page, and submit to:

http://shootout.alioth.debian.org/ http://dada.perl.it/shootout/

(On the win32 page, it only shows D 0.42, without any acutal test.)

D will then gain much more visibility.


October 10, 2004
<some@where.com> wrote in message news:ckbuo6$2q7v$1@digitaldaemon.com...
>
> How about implement all the tests on the "The Great Computer Language
Shootout"
> web-page, and submit to:
>
> http://shootout.alioth.debian.org/ http://dada.perl.it/shootout/
>
> (On the win32 page, it only shows D 0.42, without any acutal test.)
>
> D will then gain much more visibility.

I agree, and it's being worked on.