All compile time constants are defined in the header file
bc.h
. The following constants may be altered
for different hardware environments. The values used in the
example given are from the original UNIX implementation.
The number of bytes in a word.
The number of bits in a byte.
Maximum number of in-memory disk blocks that can be stored. The minimum value for this parameter is 3; there is no maximum. The more in-memory blocks defined, the lower the disk I/O requirements will be.
The number of bytes allocated to a disk block. This value should be set to a multiple of the physical disk block size. This must be defined as a power of two.
The maximum size (in bytes) of a key.
Threshold for block joining. This value determines the number of free key slots that must exist before two blocks are considered candidates for joining.
The maximum number of B Tree files that may be open concurrently.
The number of seconds to wait for a B Tree file to become unlocked, when in shared mode.
The maximum number of bytes returned for the name of the function reporting a BT error (via btcerr)/
The maximum number of bytes returned for the error message of the corresponding to a BT library error (via btcerr).
These compile time constants are assigned the following values in the distributed version:
ZBPW = 4 ZBYTEW = 8 ZMXBLK = 3 (16 when LFS=1) ZBLKSZ = 1024 (8192 when LFS=1) ZKEYSZ = 32 ZTHRES = 3 ZMXACT = 5 ZSLEEP = 5 ZRNAMESZ = 16 ZMSGSZ = 123
These values result in the minimum memory usage. If memory is not a constraint, increasing the values for ZMXBLK and ZBLKSZ will make the B Tree implementation much faster, e.g try:
ZMXBLK = 100 ZBLKSZ = 8192
The number of keys that can be stored in a block is determined at compile time, using the following definition:
#define ZMXKEY ((ZBLKSZ-ZBPW-ZINFSZ*ZBPW)/(ZKYLEN+2*ZBPW))
N.B. ZINFSZ is the number of information words that a block must carry as overhead. This value is six in this implementation.