Author: Uri Blass
Date: 06:05:07 08/24/03
Go up one level in this thread
On August 24, 2003 at 08:01:19, Ross Boyd wrote: >On August 24, 2003 at 05:37:32, Uri Blass wrote: > >>On August 24, 2003 at 00:35:07, Ross Boyd wrote: >> >>>On August 23, 2003 at 17:00:29, Uri Blass wrote: >>> >>>>I have the following piece list >>>> >>>>int queens[9][2]; >>>>int rooks[10][2]; >>>>int bishops[10][2]; >>>>int knights[10][2]; >>>>int pawns[8][2]; >>> >>>Hi Uri, >>> >>>This has nothing to do with attackboards... >>> >>>A common optimisation is to declare your arrays like this... >>> >>>int queens[2][9]; >>>int rooks[2][10]; >>>int bishops[2][10]; >>>int knights[2][10]; >>>int pawns[2][8]; >>> >>>This may result in an overall speedup if you usually iterate through all the >>>pieces for one side only. The reason this is faster is to do with the ordering >>>of the arrays in memory and memory paging.... >>> >>>Try it and see.. it may help, >>> >>>Ross >> >>I find that this arrays make my program slower. >> >>changing pawns to pawns[2][8] made it 1% slower and changing knights,bishops >>,rooks,queens continued to make it slower. >> >>Changing the int to char cancel part of the demage but it is still almost 1% >>slower. >> >>Uri > >Interesting.... I wonder why its slower? >I believe your results... but it still surprises me. > >I guess the point is that even standard optimisation techniques can actually >make things worse in some cases... and its up to us (programmers) to work out >which way is best by exhaustive trial and error. > >Sorry it didn't help, > >Ross I do not know There are other things that I do not understand. I defines all the varaibles in 2 different files (my error) one is data.c and the other is bolean.c that include only some functions that I never do during the search. I found that the program beomes slightly slower(more than 1% slower if I delete the definition from the second file). Note that I decided to have seperate file for some functions that I do not do during the search because I read that it is better to keep the functions that take time in a small file(I remember that I found that the program became slower by 3-5% after reducing the size of the file of my make move and my move generator to throw out of it functions like the setposition function but I decided that it is probably a random optimization of the compiler and did not took back that change. It is probably a waste of time to do optimizations if they do not make the code shorter and clearer or do not give me at least 5% speed improvement because there is a big chance that the speed is a result of random compiler optimizations. I use visual C++6 and I do not do special optimization except optimization for speed. I have some other things like inline any suitable function but basically I do not think to care about optimizations(at least not in the near future). I do not want to test after every small change that I do if I can do things faster by changing code generation from fast call to stdcall. There are a lot of options to change that I basically do not understand and all the linear improvement that I may get from it is not interesting for me now and I prefer not to care about this stuff before getting to the level of commercial program(after all even doing the program 20% faster can give only something near 20 elo and these 20 elo are not important when the gap from the best programs is more than 200 elo. 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.