Author: Dann Corbit
Date: 11:05:08 06/05/01
Go up one level in this thread
On June 05, 2001 at 11:29:41, Vincent Diepeveen wrote: >On June 05, 2001 at 11:14:29, Robert Hyatt wrote: > >>> >>>Now see what i get in beowulf. Instead of that in 2001 dudes program >>>better they program things out FOR EVERY PIECE. >>> >>>Even blackpawns and whitepawns are written out. >>> >>>Man such a student i would directly ship back. >>> >>> "Please make the code more general student, if you multiply a 2048 x 2048 >>> array you don't write out every multiplication either!". >>> >>>See here below the horror which i found in moves.c from beowulf project. >>> >>>How do you plan to let people learn from this code? >>> >>>They must learn to "write everything out"?? >>> >>>Please use a few for loops, even in bitboards you can do that, >>>or have you forgotten how loops work? >> >>Depends on the purpose. "unrolling" is a well-known way to speed up code. >>Compact does not always equal fast. Unrolling also eliminates some tests and >>branches, which is also good. > >I know, where did you hear me talk about getting it faster this generator? > >Dann Corbitt said this project was setup to let people learn how to write >their own chessprogram and to show how algorithms and implementing >a chessprogram in a nice manner works. > >So my comment on this piece of code is that it's not written in a way >where students learn from. > >They learn directly how to hack from this: "write everything out". > >In this piece of crap code i see everywhere: > > if (side == WHITE) > tsq = B->WhiteKnights; > else > tsq = B->BlackKnights; > >Note you can eliminate these branches, which speeds code up bigtime. > >In a test to generate for white a few million of times a list of moves >the branches will be correctly predicted, but normally spoken you get >a big misprediction there as then you generate for white and next >move for black, that hurts :) > >Apart from that it's very ugly to see code like that, >i prefer more compact code to teach students and those who >want to start their own program! Believe me when I tell you that I deeply appreciate these comments. I think it is always good to carefully look over a design and hunt for improvements. The *most important* improvements are either improvements in clarity or improvements in efficiency. If it is a push, then definitely go for clarity. Thank you, Vincent for taking the time to do this careful analysis. We will definitely look at alternatives.
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.