b647989bab9c3ea4997f1bfbcd03bb60a1c0aebe
[gnushogi.git] / doc / PORTING
1
2 This is a note how to port gnushogi to machines with scarce memory:
3 gnushogi minimal requirements are:
4  - approximately 200 kByte memory for the executable program.
5  - at least 300 kByte for data structures.
6 You dont want to port gnushogi to a machine with less memory than that.
7
8 gnushogi is optmized for speed and that means that memory has been used
9 when there has been a tradeoff between memory usage and speed. If you intend
10 to run gnushogi on a machine with less than 4 Mbyte memory the size of some
11 data structures have to be reduced. Here is a list of the largest data
12 structures in gnushogi, their sizes and a small comment on what can
13 be done to reduce their size:
14
15 ttable:         1.5     MByte   (#define vttblsz <something small>)
16 etab:           1.4     MByte   (can be removed)
17 Tree:           42      kByte   (change f,t to unsigned char)
18 history:        131     kByte   (can be removed, not recommended)
19 nextpos:        98      kByte   (nothing save rewiting all move generation)
20 nextdir:        98      kByte   (nothing save rewiting all move generation)
21 distdata:       6       kByte   (can be changed to a macro)
22 ptype_distdata: 98      kByte   (can be changed to a procedure)
23 hashcode:       26      kByte   (no reduction possible)
24
25 First of all, start by reducing the transposition table size, this
26 is done by setting vttblsz in (gnushogi.h). If the transopsition table
27 does not fit entierly in memory it will have a detrimental effect on
28 performance. You can remove the transposition table by defining 
29 compiler option NOTTABLE.
30 You can remove the static evaluation cache by omitting the compiler
31 option CACHE.
32 You can remove the history table by omitting the compiler option HISTORY
33 (NOT recommended).
34 If this isn`nt enough, reconsider if you really want to do this port.
35 There is`nt really that much to gain by changing the other
36 data structures. 
37
38 There are some switches in order to enable space reduction:
39
40 #define SAVE_PTYPE_DISTDATA     (replace ptype_distdata by a procedure)
41 #define SAVE_DISTDATA           (replace distdata by a macro)
42