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