[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [computer-go] Pattern Matcher, Excellent book on optimization



>> A simple example of that can be demonstrated using more local variables
>>
>> #define EYE_BONUS 500
>> ...
>> ... {
>>   if( a == 1 && b[i] == 361 ) // very bad and slow code
>>     score += EYE_BONUS;
>>
>> The C compilers are so good nowadays that they will be able to make
CMOV's
>> out of :
>> ...
>> ... {
>>   int x=b[i];
>>   if( a == 1 && x == 361 )
>>     score += EYE_BONUS;
>>
>> speed savings are on average a factor 12 for this piece of code.
>
>Fascinating. gcc generates better code for the first case than the
>second case, and MSVC++ generates identical code in both cases
>(corresponding to the code from gcc in the first case). Can you
>explain how that fits with your comment "very bad and slow code"?
>
>Lars
>
Depends on the Compiler switch and the type of compiler you are using. CMOV
is only supported by the latest Intel-Generation. I assume one has to use a
really good optimizing compiler that such tricks work. With other words: The
Intel-C++ Compiler.

There is an excellent book I can recommend on this topic:
R.Gerber: The Software Optimization Cookbook, INTEL-Press.

Contains also "real" recibes for the one who are interested in cooking.
Personally I like cooking, but I have problems to grasp the US-cooking
vocabulary and especially the cooking metrics like cup

Chrilly

P.S.: Either Vincent is very clever and has invented the trick for himself
or he has also read the book (which is also clever).



_______________________________________________
computer-go mailing list
computer-go@xxxxxxxxxxxxxxxxx
http://www.computer-go.org/mailman/listinfo/computer-go/