Monday, October 13, 2014

Fake asynchrony: Avoid the JSON.NET async APIs

As a developer I frequently build my own libraries or re-use existing ones. In the new async/await world, you have to consider if you implement an async version of your library.  However one thing that is important is to avoid “fake asynchrony”. Fake asynchrony is when a component has an async API, but it’s implemented by just wrapping the synchronous API within a task or thread.

This will lead to unexpected behavior and can decrease performance. One example of fake asynchrony is Newtonsoft JSON.NET, the known (and great) JSON serialization library. The creators of JSON.NET are already aware of this issue and made the async API’s obsolete:


No comments: