Chris Baus

Boost ASIO review: for the record

I happened to be looking through some old emails, and I found my review of ASIO.

In my opinion the library should be accepted. This is the best example of an asynchronous library available in either C or C++. All other major program platforms Java (NIO), .NET, Python (twisted) have well accepted asynchronous networking support, and I think this is important for C++ as a high performance networking platform going forward.

I do have one concern, but the over all design of the library is sound.

A memory allocation / deallocation is required PER REQUEST. I could live with this if it was an inherent problem with the asynchronous design pattern, but I have convinced myself that it is an artifact of the boost::bind interface combined with deferred execution. Because the size of the functor is unknown by the library it must be allocated dynamically. It is my feeling that the allocation could hurt adoption in certain markets.

Library users should be provided with the option of providing static function pointers which take an untyped parameter such as void* or boost::any as callback targets. This is how nearly all deferred allocation mechanisms currently work, and it would eliminate the allocation of the functor. Plus more complex interfaces, such as the current bind interface, could be layered on top of this architecture.