
Christopher Kohlhoff wrote: [...]
The performance problems of requiring vector<char> or char[N] exist on several levels:
- For vector<char>, there is the initialisation of the chars to 0 on [...] - Requiring a copy from a native data structure into vector<char> or [...] Avoiding unnecessary data copying is a vital part of implementing high performance protocols.
I also believe that the argument that the cost is not significant compared to network I/O does not hold when you are developing an application using asynchronous I/O, since the time spent sending/receiving no longer blocks the application. [...] Again, I believe that adding safety is best done in layers, in accordance with the don't pay for what you don't need principle:
asio::socket::send/recv etc taking void* + size_t. These functions can result in a short send or receive. ^ | asio::send_n/recv_n etc taking void* + size_t. These functions attempt to transfer the all of the requested data.
I've been skimming this conversation so far... But I thought I'd chime in with some encouragement :-) I'm *very* glad to see that you are not falling into the "it's IO so it doesn't need to fast" trap. The particular application I'm going to use asio in involves writing a low level, as in on top of UDP, protocol and software router. So I can't stress the important of having an interface that adds minimal abstraction as I'll be doing everything else. It is a rather common practice to design client server applications exclusive for high speed LAN based operation. -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - Grafik/jabber.org