fileReadBufferSize property

int fileReadBufferSize
final

Buffer a worker reads its block through, in bytes.

This only applies to decodeStream reading from an InputFileStream, which is the one case where the workers open the file themselves: a stream cannot cross an isolate boundary, so the buffer the caller chose cannot be reached from inside a worker. Everywhere else the caller already owns that decision, by passing bufferSize to InputFileStream.

Workers read different parts of the file at the same time, so the drive sees their requests interleaved rather than as one sweep. Where a seek costs something, that is the expensive part, and this is what decides how often it is paid: a 189 MB block takes 1312 reads through a 256 KB buffer, 368 through 1 MB, and 52 through the 8 MB default.

On a fast disk none of it shows, because the page cache answers most reads; on a spinning or networked one it dominates, and fewer workers with a larger buffer will beat more workers with a small one. It is charged against memoryBudget like everything else, so raising it lowers the number of workers that fit. Values below the minimum a file buffer can take are raised to it rather than rejected.

Implementation

final int fileReadBufferSize;