←back to thread

257 points keepamovin | 1 comments | | HN request time: 0.388s | source
Show context
johnisgood ◴[] No.44349236[source]
FWIW there is readv() / writev(), splice(), sendfile(), funopen(), and io_buffer() as well.

splice() is great when transferring data between pipes and UNIX sockets with zero-copy, but it is Linux-only.

splice() is the fastest and most efficient way to transfer data through pipes (on Linux), especially for large volumes. It bypasses memory allocations in userspace (as opposed to read(v)/write(v)), there is no extra buffer management logic, there is no memcpy() or iovec traversal.

Sadly on BSDs, for pipes, readv() / writev() is the most performant way to achieve the same if I am not mistaken. Please correct me if I am wrong.

At any rate, this is a great article.

replies(3): >>44349347 #>>44350985 #>>44352033 #
1. tedunangst ◴[] No.44350985[source]
Shared memory, like shm_open and fd passing, would be even faster and fully portable.