Computer Chess Club Archives


Search

Terms

Messages

Subject: Tables or Calculation

Author: David Rasmussen

Date: 17:28:03 01/17/03


I profiled my code and found (not very surprisingly) that

INLINE BitBoard Mask(Square square) { return mask[square]; }

was a hotspot.

I tried to change it to

INLINE BitBoard Mask(Square square) { return BitBoard(1) << square; }

I've tried that many times before, and this time too, the latter was slower. But
why? I mean, the latter is one instruction on x86 or something like that, and
square is probably in a register anyway. I would think that it would be faster
than a table lookup which accesses slow memory.

How come?

/David



This page took 0.01 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.