Attoparsec can parse a stream incrementally. Use this in the receiver process. Preliminary guesses shows a fall in the number of read calls to the operating system. In particular, we dropped the rate from from one call per 900 bytes to one call per 1500 bytes.
The change eliminates a lot of copying each time the PieceMgr is asked to grab new pieces for a client. Due to some rather simple assumptions, we needed to copy the PieceSets, which are really array copies. This amounts to quite some copies over time.