Author: Gerd Isenberg
Date: 12:18:09 03/28/02
Go up one level in this thread
On March 27, 2002 at 21:27:54, Ratko V Tomic wrote: >[snip...] >Similarly, you'll find that calls to member functions are often done >via indirect call via a function pointer (stored in the implicit data >field of the class), which are more expensive than the immediate x86 >calls to a fixed function. Again, you're paying the price for the >flexibility to subclass the member functions, which in many case you >would not need at all. > That is only true for virtual functions. My CNode and CSearchTree (derivered from CNode and representing the root node) Classes don't need any virtual function, but a lot of static and inlined. CNode implements updating the rotated bitboard members and a lot of eval stuff. CSearchTree implements the search including move generation, one CNode as a local on the stack in the search routine. To avoid globals is not the worst idea, considering multi-threading. There are a lot of other classes in IsiChess, like CMove (32Bit) or other previous structs, like CHashEntry. Eg it is very nice to encapsulate all the masking and shifting things with inlined getter and setter functions. Obviously these generic classes don't have any virtuals (for what?), and no implicite pointer to a class table of virtual functions. No binding at runtime required here. One main benefit using C++ for chessprograms is IMO to have typesafe macros (inline functions). C++ makes it easy to code on a rather high abstraction level, without loosing performance.
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.