Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Problem with Object Oriented Design (programming issue)

Author: Matthew White

Date: 15:27:05 09/22/03

Go up one level in this thread


On September 21, 2003 at 20:07:13, Vincent Diepeveen wrote:

>On September 20, 2003 at 15:58:03, Dave Gomboc wrote:
>
>>On September 15, 2003 at 19:28:39, Mathieu Pagé wrote:
>>
>>>In fact I have not yet implementing dynamic allocation.
>>>
>>>I'm pretty sure it's about too much constructor executing.
>>>
>>>I'd like to know if someone had ever experiments which overhead (%) should I
>>>expect when porting non-OO chess engine to OO ?
>>>
>>>Thanks for your help, i'will give a try to your idea when implementing dynamic
>>>allocation.
>>>
>>>Mathieu Pagé
>>
>>I'd expect zero overhead.
>
>then he's not using real OO features.
>
>As soon as you start using advanced stuff from object oriented programming, then
>overhead is *huge*.
>
>Let's assume for example a neat OO program that's allocating and deallocating
>objects of course. That's real neat OO programming.
>
>What junior team and others do in c++ is by no means what i call the real OO
>features.
>
>The real OO features are dead slow for chess :)
>
>>Dave

I have seen at least two speed comparison benchmarks for object oriented c++ vs.
structured C code, and in my testing the penalty for c++ is a tiny percentage.
On the order of 2-3% on the systems that I tested. The tests were OOPack and
Stepanov. I tested them with both the Intel Compiler 7.0 and gcc 3.2.3 on Linux.
Stepanov icc7:
test      absolute   additions      ratio with
number    time       per second     test0

 0        0.22sec    227.27M         1.00
 1        0.22sec    227.27M         1.00
 2        0.21sec    238.10M         0.95
 3        0.22sec    227.27M         1.00
 4        0.21sec    238.10M         0.95
 5        0.22sec    227.27M         1.00
 6        0.29sec    172.41M         1.32
 7        0.21sec    238.10M         0.95
 8        0.22sec    227.27M         1.00
 9        0.22sec    227.27M         1.00
10        0.21sec    238.10M         0.95
11        0.22sec    227.27M         1.00
12        0.22sec    227.27M         1.00
mean:     0.22sec    225.70M         1.01

Total absolute time: 2.89 sec

Abstraction Penalty: 1.01

OOPACK icc7:
                         Seconds       Mflops
Test       Iterations     C    OOP     C    OOP  Ratio
----       ----------  -----------  -----------  -----
Max            100000    1.9   1.9   52.1  52.4    1.0
Matrix           1000    0.7   0.7  352.1 342.5    1.0
Complex        100000    2.0   2.0  394.1 394.1    1.0
Iterator       100000    0.5   0.7  392.2 277.8    1.4

These "dead slow" features don't seem terribly slow to me... The only one that
took a big hit is the iterator. That could be written as C instead...

Matt



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.