SETBUFSIZE

Purpose:

Sets the maximum number of points in a series kept in main memory before using the disk for further storage.

Syntax:

SETBUFSIZE(size)

size

-

An integer, the number of points per series to keep in memory. If size == -1, the buffer size is set to the internal default. If size == -2, the size is set to the system maximum.

Returns:

An integer, the previous buffer size.

Example:

orgsize = setbufsize(1024*1024);

a = integ(gnorm(1024*1024, 1));

setbufsize(orgsize);

 

The previous buffer size is stored in orgsize and the buffer size is temporarily set to 1MB. A 1MB series is generated and saved to variable a and the original buffer size is restored.

Example:

setbufsize(-1);

 

Restores the buffer size to the internal default. The default is determined by the BUFSIZE configuration parameter in dadisp.cnf.

Example:

setbufsize(-2);

 

Sets the buffer size to maximum allowed by the system, currently 512 mega-samples for 32-bit systems and 2048 mega-samples for 64-bit systems.

Remarks:

The default buffer size is 32768 points where each point is a double precision (8 byte) value.

 

There is a trade-off between the buffer size and the number of series a Worksheet can process. When working with long data series, raising the buffer size will improve throughput, but may cause an out-of-memory condition for a Worksheet with a very large number of long series.

 

Increasing the buffer size generally increases speed of calculation for long series at the expense of available memory. Reducing the buffer size decreases calculation speed, but enables a greater number of long series to be processed.

 

The following figure depicts the relationship between a series, the buffer size, RAM (random access memory) and hard disk storage:

 

A larger buffer size results in more samples of a series residing in faster, on board RAM. If the buffer size is equal or larger than the series length, the entire series resides in memory and the buffer size for that particular series is automatically reduced to the actual series length.

 

If a series is larger than the buffer size, only one buffer of data is kept in memory at a time, reducing the memory footprint of the series, however calculation time increases because multiple buffers of data must be read from the slower disk into memory as needed. Note that for multi-column series, each column has a buffer assigned to it.

 

Use setbufsize() to return the current buffer size.

 

Set the FIT_MEMORY configuration parameter to force the buffer size to automatically adjust to the actual series size. For example:

 

setconf("fit_memory", "1")

 

In this case, all series will remain resident in memory for faster processing. However, if the system does not contain enough on board RAM to contain the series, out of memory errors may occur.

 

 

See DADiSP Memory Usage for further details.

See Also:

DADiSP Memory Usage

GETCONF

SETCONF