Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Delphi/Kylix Compiler

Author: Tony Werten

Date: 16:52:30 03/16/01

Go up one level in this thread


On March 15, 2001 at 19:30:13, Olaf Jenkner wrote:

>>>A look at the generated code shows some horrible things:
>>>
>>>Example: if(a[i]=x)or(a[i]=y)or(a[i]=z)then ...
>>>         Delphi does not know that it can load the value
>>>         of a[i] in a register only on once.
>>>
>>>I think many things could be done better without a great optimization.
>>
>>Or change the code to
>>
>>tmp:=a[i];
>>if (tmp=x) or (tmp=y) or (tmp=z) then ...
>>
>>BTW the behavour of the array a[] is different depending if it's a global,local
>>or dynamic array. So is its speed. Global dynamic is fastest if the size of the
>>elements is a multiple of 32 bit.
>>
>>That's what I mean with you have to know the compiler.
>>
>>cheers,
>>Tony
>>
>>>
>>>OJe
>
>Why do I have to program around compiler weaknesses?
>Perhaps the variable tmp is not hold in a register.
>What I mean: In simple cases, as shown above, I wish
>a better behaviour of compilers. I know that there are
>compilers which are extremely optimizing to minimize
>RAM accesses or to shrink the code or to minimize the
>number of clock ticks. All of them I can't see when I
>look at the generated code of Delphi. It's a pity because
>I don't know much about C++ and have no experience in it.

I'll have to agree with you that it would be nice if the compiler would see this
kind of stuff. But remember that it's made to work in general. Sometimes it's
about speed sometimes about size. ( I would like that switch in Delphi )

Because you are the one who knows what you want, you have to send the compiler
in the right direction. Learn some assembly and you'll find you can improve the
compiler even more because you know what it should do.

But these things are not the most important in chessprogramming, the algoritmes
you use are. You can try a lot of things in C or Pascal, change them, and when
you finally decide to stick with it, that's the time you can start to optimize.

Oh, and BTW, if you think your program is too slow, just say you go for
knowledge rather than speed.

A countryman programmer of me mulptiplied his nps by 7 before showing it on
screen just to stop people from saying it was very slow. ( he also used the
"never accept material from a better program because you're probably not winning
anything, you just think you are" algoritm )

cheers,

Tony

>
>Thanks fro your posting
>OJe



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.