Live data from Hacker News

Zero-copy in Go: sendfile, splice, and the cost of io.Copy

segflow.github.io

21–24 of 24 posts

Re: Zero-copy in Go: sendfile, splice, and the cost of io.Copy

#21
post #20
post #19

Earlier quoted context omitted.

How is a package level interface check a “language hack”? They are straight forward and provide a user the same compile time guarantees as the Java implements keyword.

Because they are a workaround for what should be a language feature in first place, just like on ML languages to type check structural types.

What exactly isn’t a language feature? Or do you have issues with semantics?

    var _ Foo = (*Bar)(nil)
The statement asserts that Bar struct pointers are assignable to a Foo interface.

I do agree it’s not as clean looking as the Java implements keyword, but it’s already a fairly terse pattern and IMO the inconvenience does not justify introducing new language syntax.

Re: Zero-copy in Go: sendfile, splice, and the cost of io.Copy

#23
post #14

Beware, there are versions of go where sendfile is broken and only sends the first 4k of a file on macos.

If this is a thing you need to beware of, you should more importantly beware of using a version of Go that's been outdated for over 1.5 years and EOL for nearly a year.

Context: https://github.com/golang/go/issues/70000 fixed in 1.23.3 (released 2024-11-06), EOL for 1.23.x was 2025-08-06

Re: Zero-copy in Go: sendfile, splice, and the cost of io.Copy

#24
post #8
post #4

Earlier quoted context omitted.

What would you prefer? I do think it is criminal this is not documented ( https://pkg.go.dev/io#Copy ), but I think io.Copy is fine as an API.

it is documented by saying it calls ReadFrom or WriteTo

Sure, but it could be more explicit. See Rust for how it should be done.
Post reply on HN