2 ms·
If you're reading sequentially this shouldn't be a problem because the VM system can pick up hints, or you can use madvise. If you're reading randomly this is
by astrange 6y ago
If you're reading sequentially this shouldn't be a problem because the VM system can pick up hints, or you can use madvise.
If you're reading randomly this is true and you want some kind of async I/O or multiple read operation.
mmap is also dangerous because there's no good way to return errors if the I/O fails, like if the file is resized or is on an external drive.
- jandrewrogers 6y agoEven if you use madvise() for a large sequential read, the kernel will often restrict its behavior to something suboptimal with respect to performance on modern hardware.