UDP Socket API: Do Buffer Sizes Matter for Vector send Functions

Hi everyone,

I am wondering whether there’s some kind of performance drawback from passing multiple small buffers to sock_udp_sendv and friends. For example, would calling sock_udp_sendv with an iolist_t containing separate buffers for a given protocol’s PDU header and payload be considered bad practice? This technique might be beneficial for a CoAP API where you want to insert options after the payload would have already been copied into the packet buffer, thus leaving no space for additional options.

Does anyone have experience with vector msg send functions in RIOT in particular or have used nanocoap or gcoap with snippet lists?

There shouldn’t be any drawback, the vectored functions were designed especially to make it possible to split headers & payload, even across layers. It’s considered good practice to use them.

We didn’t actually measure impact, just assumed that juggling larger buffers and having to copy data more often is more expensive on our little MCUs.