Memory is slow, Disk is fast

20 points by runxiyu


runxiyu

tl;dr: loading data through mmap may be slower than streaming directly from a well-designed async I/O pipeline

edk-

This is more "mmap is slow" than "memory is slow" imo. That maybe shouldn't be too surprising if you think of a loop over newly mmapped data as going into the kernel every 4KB. You don't need anything super fancy to beat it; just using read(2) is faster in many cases and many tools switched from mmap to read for performance before NVMe and io_uring were ever thought of.