The default buffer size for both reading and writing to files is 8KB:
Code: Select all
class inputStream_file : inputStream
open core
constants
defaultBufferSize = 0x2000.
If your read in 8 bit text mode (e.g. utf8), the actual buffer size is only half, because we there is an approximate doubling when converting from 8 bit characters to utf16.
An NTFS disk has a sector size of 4KB and this is what has made us choose a default buffer size of 8KB, when reading in 8 bit mode you will read one sector at the time in utf16 and binary mode you will be reading 2 sectors at the time.
A corresponding story is the case for writing.
I doubt that you will gain much by changing the buffer size, and I am not sure that what seems better on one computer/disk will also be better on another.
Windows cashes file data, disc controllers may cache file data, disks them selves may cache file data. SSD disks behaves in an other way than old "spinning" disks.
But if you want to experiment then you will have to open the files using the predicates that takes "BufferSize" as argument. For reading:
Code: Select all
constructors
openFile : (string Filename, stream::mode Mode = unicode, fileSystem_api::accessPermit Access = fileSystem_api::permitRead,
byteCount BufferSize = defaultBufferSize).
% @short Opens file #Filename for input.
% @detail Opens file with specified name #Filename for input, setting stream position to the file start (skipping byte-order mark).
% #Mode defaults to unicode.<\br>
% #Access defults to permitRead.<\br>
% #BufferSize defaults to 0x2000 (it must be even)
% @exception The fileSystem_exception::cannotCreate exception is raised if the specified file cannot be created/opened
% @end