D
Dick Grier
Hi,
There was a thread on this newsgroup about 10 days ago, that argued the
merits of a couple of different techniques for receiving TCP data from a
Socket.
I stated that my preference was to create a worker thread that polled the
GetStream.DataAvailable property, then called the Read method to retrieve
data. I have found this to perform better than using an Async Delegate
using the GetStream.BeginRead method. Others disagreed. So, when I had
time, I created a couple of benchmarks to compare, both for Pocket PC and
Smartphone devices.
The long and short of the results of these tests were that I was wrong. I
don't suppose that I was crazy, but I am convinced that I should have taken
a vacation.
On the Pocket PC, the BeginRead with callback method slightly outperformed
polling in throughput (from 7 to 8% better). There was no measurable
difference between the two methods when multitasked with another program to
place the device under load -- both degraded the same amount, as did the
performance of the other program.
On the Smartphone, there was no significant difference between methods.
That is, the throughput difference was less than 1%, interestingly with the
advantage going to the polling mode.
For anyone interested in more information please send me email. I have a
Word document that describes both the code and the results. Anyone who
wants the actual .NET solutions also can send me email.
Dick
--
Richard Grier (Microsoft Visual Basic MVP)
See www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.
There was a thread on this newsgroup about 10 days ago, that argued the
merits of a couple of different techniques for receiving TCP data from a
Socket.
I stated that my preference was to create a worker thread that polled the
GetStream.DataAvailable property, then called the Read method to retrieve
data. I have found this to perform better than using an Async Delegate
using the GetStream.BeginRead method. Others disagreed. So, when I had
time, I created a couple of benchmarks to compare, both for Pocket PC and
Smartphone devices.
The long and short of the results of these tests were that I was wrong. I
don't suppose that I was crazy, but I am convinced that I should have taken
a vacation.
On the Pocket PC, the BeginRead with callback method slightly outperformed
polling in throughput (from 7 to 8% better). There was no measurable
difference between the two methods when multitasked with another program to
place the device under load -- both degraded the same amount, as did the
performance of the other program.
On the Smartphone, there was no significant difference between methods.
That is, the throughput difference was less than 1%, interestingly with the
advantage going to the polling mode.
For anyone interested in more information please send me email. I have a
Word document that describes both the code and the results. Anyone who
wants the actual .NET solutions also can send me email.
Dick
--
Richard Grier (Microsoft Visual Basic MVP)
See www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.