Under a few operating systems, there are various ways to obtain the optimal block size for file read and write operations.
For Posix systems using fstat, it is possible to obtain the optimal block size for file operations. The stat field in question is st_blksize.
For Windows, a StackOverflow answer suggests using GetDiskFreeSpace and multiplying the lpBytesPerSector and lpSectorsPerCluster from the resulting structure. This should be the filesystem's cluster size.
Typical block sizes should be around 64 KiB for Linux systems and 4 KiB for Windows.
Under a few operating systems, there are various ways to obtain the optimal block size for file read and write operations.
For Posix systems using fstat, it is possible to obtain the optimal block size for file operations. The stat field in question is
st_blksize
.For Windows, a StackOverflow answer suggests using
GetDiskFreeSpace
and multiplying thelpBytesPerSector
andlpSectorsPerCluster
from the resulting structure. This should be the filesystem's cluster size.Typical block sizes should be around 64 KiB for Linux systems and 4 KiB for Windows.
Of course, benchmarks should be made available.