Author: Uri Blass
Date: 04:43:19 07/17/03
Go up one level in this thread
On July 17, 2003 at 06:43:30, Gerd Isenberg wrote: >On July 17, 2003 at 06:28:44, Uri Blass wrote: > >>On July 17, 2003 at 06:14:04, Richard Pijl wrote: >> >>>On July 17, 2003 at 05:58:39, Gerd Isenberg wrote: >>> >>>>On July 17, 2003 at 05:06:16, Uri Blass wrote: >>>> >>>>>Note that the name of the arrays that I have is different but I replaced the >>>>>names to make it easy to understand the problem. >>>>> >>>>>I have an array A[64][8] >>>>> >>>>>I want to replace it by 8 arrays A0[64],A1[64],...A7[64] when A[i][j]=Aj[i] >>>> >>>>Hi Uri, >>>> >>>>I would suggest A[8][64] for your purpose. >>>> >>>>Then you still may index the arrays with A[j][sq] and you get your suggested >>>>single 64 element arrays: A0[sq], A1[sq] with A[0][sq], A[1][sq] ... >>>> >>>>Gerd >>> >>>Of course! Let the compiler do the optimizing. I guess most compilers will >>>recognize this? >>>Richard. >> >>Your suggestion seems to be better. >> >>The point is that I have significant names instead of A0,A1,.... and I do not >>want to lose the significant names. >> >>I only wrote here A0, A1 to explain the point because otherwise I cannot use a >>simple formula based on the name of the array. >> >>I already finished the replace of the array and I now only need to add your >>definitions and save calculations that are done twice for both arrays. >> >>The arrays practically are not the same but every time that I call A[i][j] it is >>the same as Ai[j], so it is a waste of time to calculate A[i][j] > >Uri, if "i" is a constant, there is no waste of time! >A1[j] or A[1][j] produce the same assembler output. I understand it but this was not the point of this post(I was wrong to think that A[0][j] is faster than A0[j] from the computer point of view in the original post but not in this post and there were reasons to add the new arrays that are not speed). I will try to explain it more clearly. At this point I only checked for no bugs after replacing A[64][8] by A[8][64] Ai[j] is a different array than A[i][j] and has a different place in the memory of the computer. Ai[j] simply gives me more information than A[i][j] so I do not need the old A[i][j] I have 1)A[i][j]=Ai[j] if condition X happens. 2)A[i][j] is used only if condition X happens. 3)A[i][j]<>Ai[j] is possible if X does not happen. In the past I used only A[i][j] only when X happened I decide to build Ai[j] and now I use it also when x does not happen but A[i][j] is still used only when X happens. It means that I can replace A[i][j] by Ai[j] and save time of calculation of A[i][j]. The problem was how to calculate Ai[j] when I have only i and j and i is not a constant. In the last version I still use simply A[i][j] I did not like to use switch and I also do not like to use A[i][j] instead of Ai[j] because the names of Ai are significant names(I have 8 names that are different english words when using 8 different words in the array A[8][64] is not practical). The solution that Richard prposed seems to be good because I can keep the original 8*64 array only in the definitions and use the significant names. I can also save time relative to the situation today because I do not need to calculate the old array. I did not post the full inforamtion in the original post because I thought that the fact that A[i][j] gives more information than Ai[j] is irrelvant because there was a different reason of speed to support Ai[j]. More information may also support speed and not only knowledge but I thought that if I give too complex post then I may confuse people. 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.