I have implemented an application protocol stack that moves an incoming stream of data upward through several layers, as follows:copies a TCP segment from an OS buffer to my_buffer.after identifying a record boundary, splits the record in my_buffer into tab-separated strings which are copied into deque<string> my_deque (rather than into a vector because I then have to immediately pop a couple of fields from the front)copies my_deque to vector<string> my_records[n] where it is presented without further copying to the application.I'm wondering whether it's best to stick to a clean architecture (layering) and pay the price (whatever that is) of copying payload from layer to layer, or if there are some simple optimizations that people use.Is it customary to use separate buffers for separate layers, or is this something which can easily be optimized away without dangerously compromising the independence of the layers?
Efficiently moving data upward through a communication stack
communication;layers;buffers