Zero-copy in Go: sendfile, splice, and the cost of io.Copy
mrngm
66 points
13 comments
July 05, 2026
Related Discussions
Found 5 related stories in 1073.2ms across 14,015 title embeddings via pgvector HNSW
- The inner workings of TCP zero-copy mfrw · 49 pts · March 02, 2026 · 58% similar
- Just Use Go xngbuilds · 191 pts · May 08, 2026 · 49% similar
- Zero-Cost POSIX Compliance: Encoding the Socket State Machine in Lean's Types ngrislain · 32 pts · March 25, 2026 · 47% similar
- Rust zero-cost abstractions vs. SIMD Sirupsen · 14 pts · March 03, 2026 · 47% similar
- ZeroFS vs. Amazon S3 Files cbrewster · 75 pts · July 11, 2026 · 47% similar
Discussion Highlights (7 comments)
sanxiyn
A good reminder. It is surprising first time you encounter it. Same for Rust. As https://doc.rust-lang.org/stable/std/io/fn.copy.html says, std::io::copy can use copy_file_range(2), sendfile(2), or splice(2).
mike_hock
Zero-Copy in Go: Why magic is an antipattern, and: performance is observable behavior.
throwrioawfo
Ugh, AI slop writing.
joaohaas
Interesting premise for a post, but I had to stop midway due to the AI slop writing adding meaningless information.
inigyou
This is almost like the expression problem. Copy is a new operation, and you introduced a new type, thus creating a new grid cell nobody from either side could have reasonably known about - except for the fact Copy is in the standard library so you could have known about it but not done anything.
drivebyhooting
How is the byte counting reader supposed to work in user space without putting the buffer in user space? The article claims there is a way but I want to see what is meant by counting bytes in that case.
sly010
Beware, there are versions of go where sendfile is broken and only sends the first 4k of a file on macos.