Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: overhead of

Author: Bruce Moreland

Date: 17:00:34 01/25/98

Go up one level in this thread



On January 25, 1998 at 17:55:45, James Long wrote:

>A couple months ago I decided to completely rewrite
>my chess program "Tristram."  One of the things I'm
>doing is moving from C to C++.
>
>Now I'm ready to write some move generation routines.
>In previous versions of Tristram, I declared a
>global array CHESS_MOVE moves[MAXPLY][MAXPLY].
>
>This time I'm thinking about using a doubly linked
>list, or even an array of singly linked list
>MoveList moves[MAXPLY].

What is the point of this data structure?  I don't know why you'd need a
memory allocator at all.

>This means that every time I wanted to add a move to
>one of the list, I'd have to call the "new" routine
>to allocate the memory.
>
>Before I get into it, has anybody tried this before
>and found it too expensive?

Assuming you do need one:

The "new" that comes with any compiler has got to be a general-purpose
routine that can handle elements of any size, allocated in any order,
and freed in any order.

If you cut corners on this, it makes sense that you can do better.  You
can make a mark and release heap, if you can guarantee that you will
always free elements in exactly the reverse order than you allocated
them, for instance.

bruce



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.