BulkIoOptions struct
The shape of the asynchronous I/O of AsyncFile::ReadFile and AsyncFile::WriteFile.
On this page
- Use
import ThinkMeta.ConcurrentTasks.AsyncIo.AsyncFile;- Namespace
ThinkMeta::ConcurrentTasks::AsyncIo- Platforms
- Windows, Linux
Syntax
struct BulkIoOptionsRemarks
What counts is the amount in flight (blockSize * blocksInFlight): below about 1 MB a fast disk waits for requests; measured cold on NVMe with four samples, 1 MB x 5 was best or as good as any other shape, and a block size that grows from small to large gave nothing over a fixed one. Out-of-range values are corrected, not rejected: blockSize 0 means DefaultBlockSize, and blocksInFlight is clamped to 1..MaxBlocksInFlight. The last block of ReadFile is shorter (the rest of the file); WriteFile blocks are whatever Memory::IReadSequentialMemory::RequestReadMemory hands out, at most blockSize. startOffset is used by ReadFile only (beyond the end it reads nothing); WriteFile always writes from offset 0.
See also
AsyncFile::ReadFile, AsyncFile::WriteFile
Types
ByteCount
Fields
DefaultBlockSize
Default bytes per request (1 MB).
Syntax
static constexpr ByteCount DefaultBlockSize = 1024 * 1024;DefaultBlocksInFlight
Default number of requests in flight.
Syntax
static constexpr std::size_t DefaultBlocksInFlight = 5;MaxBlocksInFlight
Upper bound blocksInFlight is clamped to.
Syntax
static constexpr std::size_t MaxBlocksInFlight = 64;SectorAlign
Sector size the last block of an unbuffered file is rounded up to.
Syntax
static constexpr ByteCount SectorAlign = 4096;Remarks
Unbuffered (FILE_FLAG_NO_BUFFERING, O_DIRECT), every request must be a multiple of the sector size; AsyncFile::ReadFile reads the last block rounded up to this (the file ends the read), and AsyncFile::WriteFile writes a last block that is no multiple of it padded with zeros and cuts the file to its exact size.
blockSize
blocksInFlight
Requests in flight at the same time.
Syntax
std::size_t blocksInFlight = DefaultBlocksInFlight;Remarks
Clamped to 1..MaxBlocksInFlight.
startOffset
First byte read by AsyncFile::ReadFile.
Syntax
std::uint64_t startOffset = 0;Remarks
The memory gets the rest of the file; ignored by AsyncFile::WriteFile. Unbuffered, a multiple of SectorAlign.
Generated from ThinkMeta.ConcurrentTasks.API @ c7663c4 (2026-11-19).