access/udp: use pf_read rather than pf_block
With pf_block, there is, for each received packet: - one heap allocation for the block_t, - one memory copy from the block_t into the downstream filter/demux (normally the prefetch filter) in the stream core, and - one heap free in the stream core. And it gets worse if the packet size exceeds the MRU (1316 bytes). In practice, the read size (from the prefetch filter) is almost always much larger than the packet size. Using pf_read, we eliminate both the heap manipulations and the memory copies, both for sanely sized and insanely sized fragmented packets. In the corner case that the read size is actually small, this uses a circular buffer and incurs one memory copy. That is still faster than the pf_block logic.
Please register or sign in to comment