5 ms·
Even if the file is cached, fread has to do a memcpy. mmap doesn't.
by do_not_redeem 11mo ago
Even if the file is cached, fread has to do a memcpy. mmap doesn't.
- gpderetta 11mo agofread is (usually) buffered io, so it actually does two additional mem copies (kernel to FILE buffer then to user buffer)
- assbuttbuttass 11mo agoNot in Go
- gpderetta 11mo agooh, right, this is Go (https://pkg.go.dev/github.com/odeke-em/go-utils/fread#section-readme https://pkg.go.dev/github.com/odeke-em/go-utils/fread#sectio...). Do the strings it return share memory with the internal buffer?