Author: Uri Blass
Date: 10:53:56 04/15/03
I think about making 2 function of making moves(one for white and one for black. The point is that there are a lot of cases when I use the varaible side in makemove and it may be faster not to use it and to have a different code for white and black(I already has code for white and black in big part of my functions to generate moves but I also have not one code for generate white move and one code for generate black moves). The question is if it is a good idea because adding functions is going to make my program longer(it is already a big code because of many functions). My question is if there is a demage in speed from making the code bigger and if there is a way to predict it without testing. I found that there was some improvement in speed from replacing 2 of my functions by 4 functions(2 for white and 2 for black) but when I continue in this way the code becomes slower. I also suspect that a possible reason for lack of improvement is that without more functions the compiler is better in detecting patterns and the compiler may prefer seeing 2 times a slow thing and not one time slightly faster things. A possible explanation may be of course some random compiler optimization but when I see the code being slower again and again then I suspect that it is not the case. I think that I will leave it and add a special function to calculate some new varaibles and arrays that are going to be used in the evaluation. The varaibles that need to be updated may be different when it is black to move or white to move so again I may consider to have 2 functions. What is your opinion? Uri
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.