Receive vs ReceiveWithIterator

This is a fundamental question I've always wondered about, and maybe other people have as well.

Is there any performance advantage in using one or the other? Should we always use ReceiveWithIterator, or should we use Receive when none of the Iterator functionality is required?

Thanks,

Don

[321 byte] By [Don] at [2008-2-10]
# 1

It is difficult to say, but I see less than 1ns extra per receiver on the iterator handler -- yes, that is .001ms!

I set up a test which alternates sending 1 million messages to an iterator receiver, and then to a non-iterator receiver. In each case, I yield with MultipleItemReceive for the messages, and capture the stats.

On my little notebook, each iteration (1 million send and receive messages) takes around 35.5 seconds.

Thats around 35ns per message round trip. The numbers fluctuate, but on average, I see the void handler processing the messages about 1/2 second faster for one million messages, although the variance is enough that the void handler is sometimes slower than the iterator handler.

Keep in mind this is a rough test -- I have other things running on my computer, and I ran these tests only about 15 times. However, it is enough to realize that there is negligible performance improvement in using the void handler.

DaveLee at 2007-10-2 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Concurrency and Coordination Runtime (CCR)...

Microsoft Robotics Studio

Site Classified