Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: A question about varaibles that I should give to functions in C++

Author: Uri Blass

Date: 12:05:41 08/02/04

Go up one level in this thread


On August 02, 2004 at 14:47:03, Bo Persson wrote:

>On August 02, 2004 at 04:39:31, Uri Blass wrote:
>
>
>>
>>I do not understand much about speed optimizations.
>>
>>I do not care about doing the program as fast as possible and I only care not to
>>do it slower because of classes.
>
>Why do you think it would be slower?

I know that programmers of programs like Greko had very slow code because they
used C++ and not C.

>
>>
>>This is the reason that I prefer varaibles that are not used often in classes.
>
>Variables that are not used often doesn't matter at all.

This is the reason that I start with these varaibles because they are not
important for speed but using them can do the code clearer.

>
>
>>varaibles that are used often also may mean more changes to the code in order
>>not to have them as global varaibles in case that they are used in many places
>>of the code.
>>
>>I use hply not only in makemove but also in the code that check repetition and
>>sometimes in the search code when I want to look at the history to decide about
>>extensions so replacing this global varaible by something else does not seems to
>>me very simple.
>>
>>You are probably right that putting hply in another class is only a negligible
>>overhead but the problem is not only speed
>
>Gerd's point was actually that you can *gain* speed by using classes!  :-)
>
>Code that accesses global variables will have to carry the address of the
>variable in the instructions. That makes the code larger, and potentially
>slower.

I cannot avoid accesing them and I use hply in many files of the search so I do
not see an easy solution to get rid of it.

The varaible hply appears in more than 200 places in my code.

I prefer first only to convert time related varaibles to part of the class and
not global varaibles that are used often.

Doing too many changes at the same time is a way to create bugs.

Uri



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.