Author: Mathieu Pagé
Date: 23:10:57 02/21/04
Go up one level in this thread
On February 21, 2004 at 20:13:45, Russell Reagan wrote: >On February 21, 2004 at 20:01:31, Mathieu Pagé wrote: > >>Is it normal ? > >It depends how you are using the data. I think most people probably copy the >moves around a little or a lot for things like move ordering, saving the move >that was made, storing and retrieving moves from the hash table, and so on. If >you are not doing those things, then the struct might be faster. I ran into the >same problem before my program became very mature. When all my program did was >calculate perft and play random moves, I didn't have any real need to copy moves >around, so I used a struct and it was faster. Now I use an unsigned value, but >it is wrapped up inside a class, so I can change it very easily. > >This leads us to an important rule. Don't worry too much about optimization >until you have written a complete program and understand the difficulties and >problems of chess programming. This is a good example. If you only worry about >how fast the program is, then you might see that the struct is faster when you >are first writing your program. Later on, the struct might cause the program to >be slower. > >I've done all kinds of stupid optimizations that ended up making it harder on me >down the road, because I hadn't been down the road yet, so I didn't know what to >expect. Don't ignore optimization, but don't worry about it too much until you >have travelled the road at least once. After you've travelled it a few times it >will usually be pretty clear how you should structure things, and it is a good >idea to abstract things so that you can change the implementation of certain >things in your program without having to make 500 changes scattered throughout >your code (like every place you deal with a move). Even if you use C and don't >have classes, it's a good idea to use macros or inline functions and not always >touch the data directly. That has been my experience anyway. Maybe I'm just too >careless :) Thank you Russell, I will follow your advice and keep it simple for now :) Mathieu P.
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.