File Input and Output

File I/O (READ and WRITE statements and their variants) may have an effect on the efficiency of a DataBasic program. Internally these statements have to:

READV

READV should only be used when only a few attributes are required from a large item and they are not to be written back using WRITEV. In other cases it is more efficient to read the whole item.

WRITEV

This instruction has to read the whole item into DataBasic workspace, replace the relevant attribute, and then write the item back. Therefore if more than one attribute is to be written, it is more efficient to not use WRITEV so that the item is only written once.

MATREAD and MATWRITE

As MATREAD and MATWRITE have to convert between dynamic and dimensioned arrays they take longer to execute, and therefore should only be used where they provide some other benefit to performance (see topic Dynamic Arrays.).

READV of Attribute 0

A READV of attribute 0 allows the existence of an item to be checked without actually reading the item. This is especially useful when accessing items in remote files as no data needs to be copied over the network.