Author: Gerd Isenberg
Date: 13:50:28 05/21/04
Go up one level in this thread
On May 21, 2004 at 16:01:57, Dann Corbit wrote:
>On May 21, 2004 at 14:30:51, Dieter Buerssner wrote:
>
>>On May 20, 2004 at 21:48:25, Dann Corbit wrote:
>>
>>>This is also too low level for the most part, but well worth reading anyway:
>>>http://www.azillionmonkeys.com/qed/optimize.html
>>
>>I had a fast look at this one. Certainly many useful suggestions, but some also
>>seem doubtful. There is some emphasis on microoptimizations, that probably many
>>modern compilers will do as well, and perhaps better from the normal code, than
>>from the already microoptimized code. I also use often do while loops instead of
>>for (when it is clear that the first comparision in the "end-condition" will
>>always be true). In the example given in the document, only one out of 100
>>comparisions will be saved. The prize is, that the data will be accessed from
>>back to front. I guess on many computers, this will make the code slower.
>>Suggestions about some floating point optimizations seem dangerous.
>
>I agree that some of the stuff might be a little dubious, and I think the
>"tweaking" angle is way too strong. But when it comes to making something fast,
>Paul is very good at it. Algorithms are the sensible way to optimize. But if
>you can't find a better one (anyone figured out how to make chess polynomial
>time yet instead of exponential?) then some of his ideas are rather useful.
His "loop hoisting" example for instance - throwing out invariant exclusive
(if-else) conditions out of the loop body and doing exclusive cheap loop bodies
- seems obvious and i guess many compilers will do the job.
But what about none disjoint conditions inside the loop, considering todays
branch prediction heuristics?
for (int i=0; i < N; ++i)
{
if (invariantCondition1_probability1() )
doSomething1(i);
if (invariantCondition2_probability2() )
doSomething2(i);
...
if (invariantConditionj_probabilityj() )
doSomethingj(i);
}
versus
if (invariantCondition1_probability1() ){
for (int i=0; i < N; ++i)
doSomething1(i);
}
if (invariantCondition1_probability2() ) {
for (int i=0; i < N; ++i)
doSomething2(i);
}
...
if (invariantConditionj_probabilityj() ) {
for (int i=0; i < N; ++i)
doSomethingj(i);
}
isn't that clear and depends a lot on N,j, and the vectors of average
probability of the conditions, and the expense of condition bodies.
Does PGO from intel C++ and new MSC++ (PGO ?) or even GCC cover such loop
hoistings?
Cheers,
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.