On 03/26/2014 01:51 AM, Niall Douglas wrote:
Otherwise I struggle to see how these could cause the kind of figures the OP was seeing. If AFIO can push 400k ops/sec per core, and it's
Your scepticism is warranted. I accidentially misspelled the compiler optimization option, so all my performance measurements were done on debug code. Looking at the new numbers for the optimized build, the main difference between the synchronous and asynchronous case is due to the internals of the asio::io_service queue (primarily locking.)
I also tried to change your async_server so that it does not write all buffers in a loop, but instead writes the next buffer from the handler. This yielded almost the same performance results.
I also tried to omit the connection thread, so that all work is done in the io_service thread. Same performance results.
With optimization on, these changes improve performance by approx 20%.
Very odd. How much time is spent in the kernel?
Around 5% in debugging code, and 40% in optimized code.