Author: Robert Hyatt
Date: 13:25:58 06/24/04
Go up one level in this thread
On June 24, 2004 at 16:00:16, Dieter Buerssner wrote: >On June 24, 2004 at 11:56:54, Dezhi Zhao wrote: > >>On June 24, 2004 at 11:17:50, Robert Hyatt wrote: >> >>>On June 24, 2004 at 09:03:57, Gian-Carlo Pascutto wrote: > >>>>2) You need to handle the branch too. The cost of that is going to be way >>>>higher than the cost of setting up/restoring a register. >>> >>> >>>That branch is probably predicted perfectly. it is "yes" "no" "yes" "no". >>>something the PIV handles well although others do not. > >I don't think, that it really matters (speed wise), but I would assume, that it >is not a simple yes no yes no sequence. You can hit qsearch, and no capture >moves are possible. You retract one move, and hit qsearch again, with the same >color to move. Both time eval is called with the same wtm. In other cases, your >yes no sequence will happen. But to me, it doesn't look very predictable at all. >Neither would I think, that it influences speed much (branch predicted correctly >or not). I think, like Gerd, the main issue is easiness of changing the code and >the chance to code some bugs. With basically duplicated code, the probability >for errors will be higher. > >I did some speed test for my incheck function. Coding it seperately for white >and black produces somewhat better code. In practice, I found no speed >difference. > >Regards, >Dieter ] I never thought there was much of a speed issue here. I have written and re-written this stuff so many times, and the changes have really had little effect on speed so long as I don't go out of my way to make it inefficient. The only bad part of the if (wtm) { } else { } type of coding is, as you mentioned, duplication. And yes, it leads to errors. However, in Cray Blitz where I didn't do this I _also_ had my fair share of bugs caused by trying to do things like "is this rook on the 7th rank?" and the test not working for both sides, or things like "is this pushing a passer to the 7th?" and then later changing that to 6th/7th and the change not working for one side. So probably there will be bugs no matter which approach you use. And the lack of "tests" makes what I do at least pretty easy to read...
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.