Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Optimizing C code for speed

Author: Lieven Clarisse

Date: 23:32:05 01/01/03

Go up one level in this thread


On January 01, 2003 at 19:36:56, Dieter Buerssner wrote:

>On January 01, 2003 at 11:50:58, Lieven Clarisse wrote:
>
>>I know for instance that:
>>
>>ptr=&R[i];
>>if((*ptr==3)||(*ptr==7)) {;}
>>
>>is faster then:
>>
>>if((R[i]==3)||(R[i]==7)) {;}
>
>How did you test it? I checked compiler generated assembly in similar cases.
>Typically, they are the same, using pointers or arrays. Sometimes arrays will be
>faster.
>
<SNIP>
>Regards,
>Dieter

I didn't test it, I read it in some dubious book. That is why I would like to
have a *good* book about optimization. The examples were only meant as examples,
here another one:

In the same book I read this:

#pragma intrinsic strcmp

would make your program faster when using strcmp, but they don't motivate why.

--> So anyone knows a GOOD book were I can find all such things in?

best regards,

lieven




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.