Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2000:
[Freeciv-Dev] Re: #define $#@$%! template
Home

[Freeciv-Dev] Re: #define $#@$%! template

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Michael H. Price II" <price@xxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: #define $#@$%! template
From: Tomasz Wegrzanowski <maniek@xxxxxxxx>
Date: Thu, 27 Apr 2000 17:45:04 +0200

On Wed, Apr 26, 2000 at 09:05:10PM -0500, Michael H. Price II wrote:
> On Thu, Apr 27, 2000 at 01:00:29AM +0200, Tomasz Wegrzanowski wrote:
> > > I'm open to discussion.
> > 
> > And cons are :
> > - less people know c++ that c
> 
> If you continue that argument to its logical conclusion then no new
> language would ever be developed. There is a learning curve associated
> with any new product. Using it as an excuse not to learn is just silly.

It's not that core developers won't learn, we will simply have less
supporters that do more than new nations. Switching to perl will
probably end with more supporters, but I won't try any money against
this claim.

> > - c++ compiles much slower
> 
> If you limit yourself to one object (or group of very closely related
> objects) per source file then you will be hard pressed to notice any
> decrease in speed versus a C compiler.

read further

> > - c++ compiler makes worse code
> 
> People write worse code because they don't know the language as well
> as they think they do. Write proper C++ code and you will get very
> good code from any modern compiler. I challenge you to provide an
> example supporting your claim.

I accept your challenge

testing script `ctest' :
--- start ---
#!/bin/sh
time for n in 1 2 3 4 5 6 7 8 9 10 ; do  gcc hello.c -o c ; done
time for n in 1 2 3 4 5 6 7 8 9 10 ; do  g++ hello.C -o cplus ; done
ls -l c cplus
time for n in 1 2 3 4 5 6 7 8 9 10 ; do ./c ; done
time for n in 1 2 3 4 5 6 7 8 9 10 ; do ./cplus ; done
--- end ---

(hello.c and hello.C are both links to hello, this is the most fair way I found)

hello file :
--- start ---
int main () {
return 0;
}
--- end ---

(there is NO easier file)

$ ./ctest >log 2>&1
$ cat log
--- start ---
real    0m3.514s
user    0m2.280s
sys     0m0.830s

real    0m5.900s
user    0m3.130s
sys     0m0.990s
-rwxrwxr-x    1 bashiz   bashiz       4583 Apr 27 17:25 c
-rwxrwxr-x    1 bashiz   bashiz       4977 Apr 27 17:25 cplus

real    0m0.079s
user    0m0.020s
sys     0m0.060s

real    0m0.275s
user    0m0.150s
sys     0m0.030s
--- end ---

As you see, c++ compiler runs slower, makes bigger code, makes slower code
for simplest hello code. I have also tried more complex code :
--- start ---
#include "stdio.h"

int main () {
printf ("Hello, world\n");
return 0;
}
--- end ---

$ ./ctest >log 2>&1
$ cat log
--- start ---
real    0m7.110s
user    0m3.160s
sys     0m1.070s

real    0m9.636s
user    0m4.470s
sys     0m1.190s
-rwxrwxr-x    1 bashiz   bashiz       4717 Apr 27 17:35 c
-rwxrwxr-x    1 bashiz   bashiz       5115 Apr 27 17:35 cplus
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world

real    0m0.089s
user    0m0.030s
sys     0m0.050s
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world

real    0m0.953s
user    0m0.150s
sys     0m0.080s
--- end ---

Again, slower compiler, bigger code, slower code.
I have tried to check assembler output,
c and objc make the same code
c++ adds twice much labels and some strange db's list on the end

What do you think ???



[Prev in Thread] Current Thread [Next in Thread]