Author: Gerd Isenberg
Date: 13:42:01 07/17/03
Go up one level in this thread
>> >>You have the old int array with swapped indicies [8][64] now. > >Yes > >>You need a second one with some conditional stuff. > >I think that the there may be a misunderstanding about the conditional stuff. >I am not sure about what I need and I will describe what I have. > >I have now the old int array with swapped indices A[i][j] >and I have also 8 different arrays Ai[j] that are in different place in the >memory. > >I use both arrays. > >Every time that I use A[i][j] I have A[i][j]=Ai[j] but >there are cases when I use Ai[j] when Ai[j]!=A[i][j] because I do not care to >update A[i][j] > >A[i][j] was planned to give information only when some condition about square i >exists so it is used only in these cases. > >Ai[j] is planned to give information also when the condition about square i does >not hold and in these cases I may have Ai[j]!=A[i][j] > >I tried to tell the compiler that Ai[j] and A[i][j] mean the same thing by >definition and for some reason the result is that the code is slower. > >I tried it by replacing >int A0[64]; >int A1[64]; >... >int A7[64]; > >by >int *const A0=A[0] >int *const A1=A[1] >... >int *const A7=A[7] > >Of course I have significant names instead of A A0,...A7 > >Unfortunately I found that the result is slower by almost 5%. I see, so your intention is that A1..A7 are only constant alias names for A[0]...A[7]. An additional reference costs some time. To address of A[0] is known during compile time - shorter and faster code. The access via A0 is only resolvable at runtime - more code and an additional memory access: i = A[0][j]; mov eax, [_A + 4*ebx] ; j in ebx but i = A0[j]; // is may be something like this mov esi, [_A0] ; get the pointer of _A in esi mov eax, [esi + 4*ebx] and that's only for readability? What about MACROS? #define A0 A[0] and maybe later #undef A0 or even in other context #define A0 A[1] Regards, Gerd
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.