DADiSP Worksheet Functions > Function Categories > Worksheet Control > SETBUFSIZE
Sets the maximum number of points in a series kept in main memory before using the disk for further storage.
SETBUFSIZE(size)
size |
- |
An integer, the number of points per series to keep in memory. If |
An integer, the previous buffer size.
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.
setbufsize(-1);
Restores the buffer size to the internal default. The default is determined by the BUFSIZE configuration parameter in dadisp.cnf.
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.
The default buffer size is 32768 points where each point is a double precision (8 byte) value.
There is a
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
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.