(no title)
gustavpaul | 4 months ago
It also means the latency due to pagefaults is shifted from inside mmapReader.ReadRecord() (where it would be expected) to wherever in the application the bytes are first accessed, leading to spooky unpreditactable latency spikes in what are otherwise pure functions. That inevitably leads to wild arguments about how bad GC stalls are :-)
An apples to apples comparison should be copying the bytes from the mmap buffer and returning the resulting slice.
loeg|4 months ago
Nit: Mmap mapping lifetimes are not attached to the underlying fd. The file truncation and latency concerns are valid, though.
dahfizz|4 months ago
You shouldn't replace every single file access with mmap. But when it makes sense, mmap is a big performance win.
dapperdrake|4 months ago
Good point.