Author: Ross Boyd
Date: 05:01:19 08/24/03
Go up one level in this thread
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
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.