Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: To anyone who has ever automatically created an opening book

Author: Dann Corbit

Date: 12:18:47 11/12/01

Go up one level in this thread


On November 10, 2001 at 14:38:51, Vincent Diepeveen wrote:

>On November 09, 2001 at 11:54:42, John Merlino wrote:
>
>>Since I am modifying the opening book format in Chessmaster to allow an
>>"unlimited" number of moves in a book, I was wondering a few things about the
>>general performance of my PGN importer.
>>
>>Some questions:
>>
>>1) In general, how long does it take to create a book (i.e. size to time ratio).
>
>In diep-engine it takes depending upon number of games (1 million)
>around a full night.
>
>>2) How much memory does the process take (size to RAM ratio).
>
>i can set that size, but up to 500MB it might swallow in. the
>RAM ain't the problem. the slow allocation and deallocation of
>memory is.

Why not write your own suballocator?

I usually do it with a linked list.  I allocate in big chunks (for instance 1
megabyte) and then suballocate using an array of bits to tell me what blocks are
free.  You can choose any granularity you like for the memory blocks.  It is
especially easy if all the suballocated blocks are the same size (e.g. 32 bytes
or something) in which case, the computations are implicit.

I once found that it was faster to read a file twice and perform a single
allocation than to read it in line by line, and allocate a new buffer for each
line as read.  The memory allocation routines can be really awful, as you have
noticed.



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.