Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: To Recurse or not to Recurse...

Author: Tony Werten

Date: 07:22:45 10/31/00

Go up one level in this thread


On October 31, 2000 at 08:30:04, Steve Maughan wrote:

>In my chess program I use recursion to carry out the basic alpha beta search.
>However while on one of the Delphi newsgroup I was told that recursion is a
>source of significant inefficiency and that _ALL_ recursive algorithms can be
>converted into an iterative form that is generally faster.  Upon searching the
>net I found this site:
>
>http://www.geocities.com/zabrodskyvlada/aat/a_recu.html
>
>This basically shows that the recursive version of a sort runs at half the speed
>of the alternative version.  Moreover, thinking back I remember that Ed Schroder
>mentioned that he doesn't use recursion.

Hi steve,
>
>How many people do use recusion?

almost everybody.

>
>Is there any literature on non recursive alpha / beta?

Hardly, except for some mathbooks.
>
>Has anyone done any comparisons between recursive and none recursive searches?
>

Yep, have been working on it for the last week. If I use non-recursive plain
minimax, I go less than 25% faster. If I add alfa-beta it will be less, then the
overhead of nullmove ,extensions decissions etc and I'm probably back to 0.

The reason is that in normal math recursion, the actual function code is very
small, so the biggest overhead is the functioncall (and pushing the stuff on the
stack). In alfabeta you do quite a lot in your function, so the overhead is
relative small.

This added to the fact that you have to redo your math for the iterative
version, I wouldn't recommend switching from recursion.

If you're affraid about the memory-stress of recursion, use more global arrays,
and keep the number of local variables to a minimum.

cheers,

Tony


>Regards,
>
>Steve



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.