[EMAIL PROTECTED] wrote: > Well, lets say you have a situation where you're going to be > alternating between sending large and small chunks of data. Is the > solution to create a NetworkBuffer class and only call send when the > buffer is full, always recv(8192)?
Buffering can often improve performance, but with the above we'd to too quick to prematurely jump to an as yet unwarranted conclusion. You measured the one-large and many-small cases, but not the case you actually have. You might be able to take various measurements and generally characterize speed as a function of the number of calls and the size of the send. I wouldn't be surprised if the result is well approximated by a time per call plus a time per byte. In optimization, guessing is bad. Where you cannot reason with mathematical rigor, measure. Where you can derive a purely analytic result, taking the occasional measurements still isn't a bad idea (but don't tell my algorithms students). -- --Bryan -- http://mail.python.org/mailman/listinfo/python-list