Implementing sendmsg and recvmsg for PyPy

Sendmsg and recvmsg are two system calls which allow to send messages on a socket as one could by using send/recv or sendto/recvfrom with a few noticeable differences:

  • Extra information can be passed in a packet on a socket that is not considered part of the message. This is known as ancillary data or control information.
  • Sendmsg and recvmsg can be used on both connected or unconnected sockets (if the protocol allows) due to the option to specify the address similar to how sendto/recvfrom work.
  • The ancillary data allowed through the socket differs from one socket type to another. For example, on Unix socket sendmsg and recvmsg can use ancillary to pass file descriptors from one process to another, where as on UDPv6 they can allow for extra information regarding the packet (such as IPV6_PKTINFO​) to be attached in the ancillary.

Read More »


Enabling Profile Guided Optimizations for PyPy

PyPy, compared to CPython relies more on achieving speed-up by “jitting” code as often as possible, rather than rely on its interpreter. However, jitting is not always an option, or at least not entirely. A good improvement for CPython, that we think might benefit PyPy as well, without impacting the JIT performance is Profile Guided Optimization (PGO or profopt).

I thank the PyPy developer community for their patience, kind advice and constant feedback they gave me in #pypy IRC or through email, which helped me to make this possible, especially to Carl Friedrich Bolz-Tereick and Armin Rigo.

Read More »