Why is a FIFO pipe on macOS ~8x slower than an anonymous pipe?
On an M1 Max, I have created a FIFO named pipe with mkfifo
and am testing write/read performance with a simple C program and pv
. The program writes 65536 bytes at a time to stdout. When doing ./writer | pv > /dev/null
, I get ~8 GiB/s. When doing ./writer >> mypipe
and pv mypipe > /dev/null
, I get ~1 GiB/s. For both of these, if I print the amount of writes performed, the 8x factor is about the same between the two. I’ve yet to test this on Linux and have not found any fnctls
I can run on macOS/darwin that can change the buffer size of the FIFO pipe.