www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - D performance compared to C++/Heron (take 2)

reply "christopher diggins" <cdiggins users.sourceforge.net> writes:
I wrote a new program for comparing the efficiency with which Heron handles
polymorphic objects in comparison to C++ and D and put it at
http://www.heron-language.com/benchmarks/index.html . I tried to take into
account the many excellent suggestions brought in from the earlier
discussion. As before I would like feedback on how to keep the comparison
fair and accurate for the given example.

On a related note: The DMC compiler created very efficient code but two
issues came up, it seems to choke on a delete[] function for the C++
example, so I would appreciate if any one could tell me whether it is a bug
my code or DMC. The other issue is the DMC has problems with namespaces.

-- 
Christopher Diggins
http://www.cdiggins.com
http://www.heron-language.com
May 13 2004
next sibling parent "Zz" <Zz Zz.com> writes:
I just tried your benchmark on my machine the time is 219 for D but with
VS7.1 the C++ is aprox double that of D as for heron the time is 15 using
the above compiler.

I never thought of comparing D with VS and the results supprised me.

Zz

"christopher diggins" <cdiggins users.sourceforge.net> wrote in message
news:c80cdu$9l4$1 digitaldaemon.com...
 I wrote a new program for comparing the efficiency with which Heron
handles
 polymorphic objects in comparison to C++ and D and put it at
 http://www.heron-language.com/benchmarks/index.html . I tried to take into
 account the many excellent suggestions brought in from the earlier
 discussion. As before I would like feedback on how to keep the comparison
 fair and accurate for the given example.

 On a related note: The DMC compiler created very efficient code but two
 issues came up, it seems to choke on a delete[] function for the C++
 example, so I would appreciate if any one could tell me whether it is a
bug
 my code or DMC. The other issue is the DMC has problems with namespaces.

 -- 
 Christopher Diggins
 http://www.cdiggins.com
 http://www.heron-language.com
May 13 2004
prev sibling next sibling parent "Zz" <Zz Zz.com> writes:
Extra note:
 Executable from D was smaller: 77.340 vs 94.208 and i'm using D 0.86

Zz

"christopher diggins" <cdiggins users.sourceforge.net> wrote in message
news:c80cdu$9l4$1 digitaldaemon.com...
 I wrote a new program for comparing the efficiency with which Heron
handles
 polymorphic objects in comparison to C++ and D and put it at
 http://www.heron-language.com/benchmarks/index.html . I tried to take into
 account the many excellent suggestions brought in from the earlier
 discussion. As before I would like feedback on how to keep the comparison
 fair and accurate for the given example.

 On a related note: The DMC compiler created very efficient code but two
 issues came up, it seems to choke on a delete[] function for the C++
 example, so I would appreciate if any one could tell me whether it is a
bug
 my code or DMC. The other issue is the DMC has problems with namespaces.

 -- 
 Christopher Diggins
 http://www.cdiggins.com
 http://www.heron-language.com
May 13 2004
prev sibling next sibling parent hellcatv hotmail.com writes:
I haven't had a chance to look at it more carefully but valgrind itself doesn't
turn up anything (that usually catches array overruns and malloc problems)
but valgrind doesn't always catch things (in toy examples like this it
invariably does)
--Daniel

In article <c80cdu$9l4$1 digitaldaemon.com>, christopher diggins says...
I wrote a new program for comparing the efficiency with which Heron handles
polymorphic objects in comparison to C++ and D and put it at
http://www.heron-language.com/benchmarks/index.html . I tried to take into
account the many excellent suggestions brought in from the earlier
discussion. As before I would like feedback on how to keep the comparison
fair and accurate for the given example.

On a related note: The DMC compiler created very efficient code but two
issues came up, it seems to choke on a delete[] function for the C++
example, so I would appreciate if any one could tell me whether it is a bug
my code or DMC. The other issue is the DMC has problems with namespaces.

-- 
Christopher Diggins
http://www.cdiggins.com
http://www.heron-language.com
May 13 2004
prev sibling next sibling parent reply "Walter" <newshound digitalmars.com> writes:
"christopher diggins" <cdiggins users.sourceforge.net> wrote in message
news:c80cdu$9l4$1 digitaldaemon.com...
 I wrote a new program for comparing the efficiency with which Heron
handles
 polymorphic objects in comparison to C++ and D and put it at
 http://www.heron-language.com/benchmarks/index.html . I tried to take into
 account the many excellent suggestions brought in from the earlier
 discussion. As before I would like feedback on how to keep the comparison
 fair and accurate for the given example.

 On a related note: The DMC compiler created very efficient code but two
 issues came up, it seems to choke on a delete[] function for the C++
 example, so I would appreciate if any one could tell me whether it is a
bug
 my code or DMC. The other issue is the DMC has problems with namespaces.
D doesn't have a problem with namespaces. Replace #include <iostream.h> (which predates namespaces) with: #include <iostream> which is the standard version and compile with -I\dm\stlport\stlport
May 13 2004
next sibling parent "Walter" <newshound digitalmars.com> writes:
 "christopher diggins" <cdiggins users.sourceforge.net> wrote in message
 news:c80cdu$9l4$1 digitaldaemon.com...
 On a related note: The DMC compiler created very efficient code but two
 issues came up, it seems to choke on a delete[] function for the C++
 example, so I would appreciate if any one could tell me whether it is a
bug
 my code or DMC.
It's a dmc bug. Oops.
May 13 2004
prev sibling parent reply "KTC" <me here.com> writes:
"Walter" wrote...
 D doesn't have a problem with namespaces. Replace
     #include <iostream.h>
 (which predates namespaces) with:
     #include <iostream>
 which is the standard version and compile with -I\dm\stlport\stlport
Been meaning to ask this for ages, this seem as good a time as any so here goes: One of the main selling point of DMC is it's build time and exec speed & size. However, if one want to use the standard library with namespace, one need to use STLport. How come the size of the output from DMC ballon from ~70KB to ~350KB if one change from using <iostream.h> to <iostream> & -I\dm\stlport\stlport\. ? Is there something I'm not doing that could reduce the size of a program that uses the standard library back down? Cheers, KTC -- Experience is a good school but the fees are high. - Heinrich Heine
May 14 2004
parent "Walter" <newshound digitalmars.com> writes:
"KTC" <me here.com> wrote in message news:c828g4$309a$1 digitaldaemon.com...
 "Walter" wrote...
 D doesn't have a problem with namespaces. Replace
     #include <iostream.h>
 (which predates namespaces) with:
     #include <iostream>
 which is the standard version and compile with -I\dm\stlport\stlport
Been meaning to ask this for ages, this seem as good a time as any so here goes: One of the main selling point of DMC is it's build time and exec speed
&
 size. However, if one want to use the standard library with namespace, one
 need to use STLport. How come the size of the output from DMC ballon from
 ~70KB to ~350KB if one change from using <iostream.h> to <iostream>
 & -I\dm\stlport\stlport\. ?
     Is there something I'm not doing that could reduce the size of a
program
 that uses the standard library back down?
That's one reason why I don't like <iostream>.
May 14 2004
prev sibling parent "C. Sauls" <ibisbasenji yahoo.com> writes:
Moving up to DMD 0.86 seems to improve its performance, but I might be 
wrong.  Also, just for sakes, you might rewrite the D code to be more, 
well.. D-ish.  :)  Something like the following:

------------------------------
void main() {
   const int SIZE = 1000;

   float         nMsecElapsed;
   d_time        tStart,
                 tElapsed;
   Indexer[SIZE] a;

   foreach (inout Indexer x; a)
     x = new Indexer;
   printf("size of array (bytes) = %d\n",(a[0].classinfo.init.length * 
SIZE) + (a[0].size * SIZE));

   tStart = getUTCtime();
   foreach (Indexer x; a)
     RunTest(x);
   tElapsed = getUTCtime() - tStart;
   nMsecElapsed = (cast(float)tElapsed / cast(float)TicksPerSecond) * 
1000.0;
   printf("time elapsed (msec) = %f\n", nMsecElapsed);
}
------------------------------

Note the use of an actual array instead of a pointer, and of foreach.  I 
  tried compiling this, and it made absolutely zero difference in EXE 
size or speed.  Not that I really expected any.

-C. Sauls
-Invironz
May 14 2004