Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Tables or Calculation

Author: Sune Fischer

Date: 00:13:15 01/18/03

Go up one level in this thread


On January 17, 2003 at 20:28:03, David Rasmussen wrote:

>I profiled my code and found (not very surprisingly) that
>
>INLINE BitBoard Mask(Square square) { return mask[square]; }
>
>was a hotspot.

How do you profile an inlined function, shouldn't they be absorbed into the
code?
If the profiler can measure function call overhead I wouldn't be surprised if it
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?

There is almost no difference, I found the shift marginally faster though.
-S.

>/David



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.