Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: question about importance of branchless code for speed

Author: Uri Blass

Date: 08:20:14 04/09/03

Go up one level in this thread


On April 09, 2003 at 11:11:01, Uri Blass wrote:

>Supppose file1 and file2 are numbers between 0 and 7.
>
>Am I correct to assume that in general it is better to not to use
>
>int A[8];
>If (file1<=file2) x+=A[file2-file1];
>
>
>but instead of it something like
>
>int PADDED_A[15];
>int * const A = PADDED_A+7;
>x+=A[file2-file1];
>
>\\A[x]=0 for x=-1,x=-2,...x=-7
>
>
>Uri

The main question is if it is dependent on the probability that file1<=file2
because if file1>file2 in most of the cases then in most of the cases
I do not need to find A[file2-file1] and the question is if the panelty for if
is big enough to justify a lot of array calls.

For the discussion x is unsigned integer and A is an array of unsigned integers.

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.