Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Use of objects and associated performance hit?

Author: Dann Corbit

Date: 19:21:24 12/30/99

Go up one level in this thread


On December 30, 1999 at 21:55:26, Tom Kerrigan wrote:

>On December 30, 1999 at 21:29:07, Dann Corbit wrote:
>>>1. When I access the chess board class from the engine class, will there be a
>>>performance hit?
>>As close to zero as is humanly imaginable unless you do some exotic things like
>>RTTI.  SEH takes a small toll also.  Templates often give a performance BOOST.
>
>I'm not familiar with either of these acronyms. I don't intend to use
>templates... I'm just going to have two classes, one derived from the other.

RTTI is Run Time Type Interpretation (or something like that).  It means that
you figure out what kind of a thing something is on the fly.  It can be used to
write extremely generic stuff, but there is an obvious performance hit.  You
probably don't need to worry about it.  I almost never use it.

SEH is Structured Exception Handling.  It means you are using the
try { //stuff that I really want to do...
}
catch (exception type 1) // maybe memory allocation failure
{
// handle exception
}
catch (exception type 2) // maybe floating point error or whatever...
...
catch (...) // Some other exception I did not imagine...
{
// handle exception
}

Which is wonderfully useful, but there is a small performance penalty incurred.

>>>2. If I have multiple instances of the engine class, can each one run on a
>>>different processor without a performance hit?
>>That is an architecture question that cannot be answered without the complete
>>model.  I assume that they must talk to each other or at least communicate with
>>a common object.  When starting threads, some API's have lightweight and
>
>Communication between the engines will (hopefully) be minimal. I was just
>wondering if there's some known issue that bites C++ programs that are
>multithreaded. (Perhaps how most C++ programs are organized in memory, or some
>sort of function overhead that clobbers the cache.)

None.  Most of the "C++ is slower than C" stuff is rumor and net legend.  Junior
is written in C++ {for instance} and obviously is fast as the burning blue
blazes.  Plus, it is multithreaded now.  If anything, abstraction would make
that process a lot easier.  Amir Ban can probably give insight.



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.