Author: Uri Blass
Date: 14:20:50 02/26/03
Go up one level in this thread
On February 26, 2003 at 15:07:49, Matt Taylor wrote:
>On February 26, 2003 at 09:48:13, Uri Blass wrote:
>
>>On February 26, 2003 at 08:45:30, Pat King wrote:
>>
>>>On February 25, 2003 at 12:40:18, Uri Blass wrote:
>>>
>>>>On February 25, 2003 at 12:31:14, Pat King wrote:
>>>[prior to this Uri and Pat wrote a lot of stuff]
>>>>>>
>>>>>>data.h is varaibles when defs.h is definition.
>>>>>>I learned it from tscp.
>>>>>>
>>>>>>some varaibles are dependent on definition so I need to include defs.h first
>>>>>
>>>>>I would submit that this is a bad feature of tscp.
>>>>
>>>>so what do you think?
>>>>
>>>>Do you suggest to include all the definitions and the external varaibles in the
>>>>same file?
>>>>
>>>>I do not see why it is a problem except the error that I reported and finding
>>>>and fixing the error took me only few minutes.
>>>>
>>>I haven't looked at tscp or at your code, but you seem to be saying that you're
>>>declaring a bunch of variables as extern in a header, with the actual
>>>declaration hidden somewhere in the source.
>>
>>It is hidden in the file data.c
>>If I change a varaible I need to change both data.h and data.c
>>
>>
>> This can be a maintenance problem
>>>because you must remember to change both files.
>>
>>I do not think that it is significant problem because the time that
>>I spend on changing names of varaibles is very small relative to the time that I
>>spend about thinking and changing other things.
>>
>>I try to do changes that do my program simpler and faster but I can say that I
>>am disapponted from the speed result of the last change.
>>
>>The change that I did was simply to change my loops by using the break command.
>>
>>I have a lot of loops of the following 2 types(I have different varaibles)
>>
>>Type 1:
>>
>>do
>>{
>>...=...//do not change the condition but I do not know if I can use
>>this fact to do the program faster
>>if condition
>>x=a[x];
>>else
>>x=-1
>>}
>>While (x!=-1)
>>
>>
>>Type 2:
>>while (x>=0)
>>{
>>...=...//again do not change the condition
>> if (condition)
>> x-=8;
>> else
>> x=-1;
>>}
>> }
>>
>>In part of the cases the condition is more complicated then if (x!=-1) but x=-1
>>is enough to make the condition false.
>>
>>I change it to else break.
>>I hoped to see some small speed improvement but unfortunately
>>I did not see it
>>
>>I saw a small speed improvement after part of the changes but it was gone
>>after I completed the change.
>>
>>It may be a compiler random error but I wonder if break has a price in speed
>>and if there are better way to get out of a loop.
>>
>>Uri
>
>What you should do is change it to this:
>if (!condition)
> break;
>
>// continue doing stuff
>
>It's not going to get you a lot of performance increase, but that is the
>"correct" way to do it from an assembly programmer's point of view.
>
>As others have said, concentrate on making everything work, improving
>algorithms, etc. You don't necessarily have to play faster to be a stronger
>player.
>
>-Matt
Thanks for all the advices and I will try them tomorrow.
I can say about the last advice the following
1)I believe that the biggest improvement can be done by better evaluation and
better search rules but the problem is that if I decide to do it first it will
be harder to get speed improvement by better data structure and speed
optimizations because I will need to change more code.
2)one of the problems that prevent movei to be faster is that I do not have a
function only to generate captures and I do not have a function only to generate
captures and checks.
I believe that having these functions together with counting legal moves may
give me a significant improvement but before building these functions I prefer
to change my data structure(otherwise it will be harder to do it) and I decided
before doing it to look again in my functions.
Thinking more about my functions led me to the conclusion that I probably can
improve by break command so I started to do it because it is a change that is
independent on the change that I may do in the data structure.
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.