On macOS we can double read and write performance and reduce cpu usage with the private APIs:
ssize_t recvmsg_x(int s, const struct msghdr_x *msgp, unsigned int cnt, int flags);
ssize_t sendmsg_x(int s, const struct msghdr_x *msgp, unsigned int cnt, int flags);
These are like recvmmsg and sendmmsg in Linux/FreeBSD, transferring multiple messages in one syscall.
In both case we fallback to standard read/write as a backup.
On macOS we can double read and write performance and reduce cpu usage with the private APIs:
These are like recvmmsg and sendmmsg in Linux/FreeBSD, transferring multiple messages in one syscall.
The best documentation is here:
https://github.com/nirs/vmnet-helper/blob/main/socket_x.h
Example usage in vmnet-helper:
In both case we fallback to standard read/write as a backup.
I learned about this from bun:
https://github.com/oven-sh/bun/blob/main/packages/bun-usockets/src/internal/networking/bsd.h