Author: Gerd Isenberg
Date: 00:30:56 08/02/04
Go up one level in this thread
<snip> >I am afraid that it is going to do the program slower. Yes, you have to access such member variables via a pointer, which is passed to none static member functions as "this" pointer. But that's most often only negligible overhead. E.g. with AMD64 (fastcall) and 16 gp registers it is likely that a "this"-pointer to the object containing search variables in a recursive search routine is kept in rcx (64-bit mode) or ecx (32-bit mode has only 8 gp registers). Accessing a member variable in x86 assembly is done via [ecx+offsetOfVariable] instead of the global access via [addressOfVariable]. If offsetOfVariable is less than 128 bytes, it is coded as byte offset, and instructions are therefore up to three or even four (offset 0) bytes shorter. One reason to keep often used class or struct data members at the beginning of a struct, of course considering alignment and padding issues. > >hply is used in every node unlike time varaibles. >I can robably use a function get_hply that will get hply from the GameControl >object and not use it as global varaible but I am afraid that it is going to do >the program slower if I do it everytime that I need hply. > >Another point is that I do not want to do too big changes in the code and I >prefer to change it more slowly. > >I first want to get rid of global varaibles that are rarely used and maybe later >I will think about getting rid of global varaibles that are used more often like >hply. > >Uri A first step might be to replace several globals by global structures (class is synonym for struct, except struct has default access modifier public, while class has privat) or static class members. Keeping in mind what logically belongs together, considering possible later to implement multi threading search. Gerd
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.