haskell-distributed/distributed-process — pull request #144 by jeremyjh (2014-03-10 01:33:23+00:00)
Title: Throttle MxAgent mailbox reads

This commit : 2ffa2bc5171f8c51e3269ee1a7565a8842333dec

Created a major performance regression for me when an agent sink is registered - [see example sink](https://gist.github.com/jeremyjh/9457914) .
This introduced delays in my test cases of many hundreds of ms in the send of small strings.

The cause is that the read on the TChan (and new read of mailbox) no longer blocks, so the thread
runs in a very tight loop and consumes roughly a CPU core. I believe a delay needs to be introduced between attempts to read, and the PR contains one such approach, there may be another that you would prefer but this at least does work in my case.