|
Boost Users : |
From: KSpam (keesling_spam_at_[hidden])
Date: 2008-03-04 00:43:58
JC,
> Do you think the speed is OK for data transmission over udp sockets?
Unfortunately, this is a difficult question to answer, so I will resort to the
standard engineering response ... it depends :-) There are many parameters
that can play into the answer, and they all depend on the nature of the
application. For instance:
What frequency are messages being sent?
What is the average message size?
What is the speed and reliability of the network connection?
There will obviously be some overhead required in compressing the messages.
If the network connection is unreliable or slow, then the overhead may be
worthwhile. If the network is reliable and fast (or if your sending or
receiving processor is slow), the compression overhead may not be worthwhile.
Of course, the beauty of Boost.Iostreams is that adding, removing, or
changing the compression type is very easy to do. When you prototype your
application, you can perform throughput analysis to determine the optimal
setup.
I modified the example I sent to add a bzip2 compression test (ALGO 4) and a
no compression test (ALGO 3). Here are the results from running a debug
Linux build on my machine:
ALGO 0 : 10000 cycles took 1.261 seconds!
ALGO 1 : 10000 cycles took 1.2 seconds!
ALGO 1 : Improvement 4.83743 %
ALGO 2 : 10000 cycles took 0.652 seconds!
ALGO 2 : Improvement 48.295 %
ALGO 3 : 10000 cycles took 0.218 seconds!
ALGO 3 : Improvement 82.7121 %
ALGO 4 : 10000 cycles took 0.928 seconds!
ALGO 4 : Improvement 26.4076 %
For grins, here are the release build results:
ALGO 0 : 10000 cycles took 0.927 seconds!
ALGO 1 : 10000 cycles took 0.88 seconds!
ALGO 1 : Improvement 5.07012 %
ALGO 2 : 10000 cycles took 0.345 seconds!
ALGO 2 : Improvement 62.7832 %
ALGO 3 : 10000 cycles took 0.028 seconds!
ALGO 3 : Improvement 96.9795 %
ALGO 4 : 10000 cycles took 0.597 seconds!
ALGO 4 : Improvement 35.5987 %
As you can see, the no compression case (ALGO 3) is significantly faster. In
this case, zlib compression (ALGO 2) is faster than bzip2 compression (ALGO
4). Bzip2 compression generally compresses the data better than zlib
compression though. There's always a tradeoff :-)
Hope This Helps,
Justin
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net