Re: [Boost-users] Sockets and structures?
On Fri, Sep 25, 2009 at 6:49 PM, Daniel F. Savarese
In message <3f49a9f40909251225p28d497b6i6d73c2dd53e3ba3e@mail.gmail.com>, Overm indDL1 writes:
Boost.Serialization is good if you are going to serialize up vast hierarchies with lots of pointers that can be self referencing and such, but it tends to be very costly in execution speed. Something like Boost.Spirit2.1 can serialize things up to a binary format as well, and *very* fast. Although something like Google's open source message system could serialize up messages even better (we need a Boost implementation of that system... hmm...).
To the OP, I would advise you not take statements such as the above as gospel without performing measurements yourself. My experience[1] is directly contrary to the above. I find boost::serialization execution time to be negligible (for binary archives) and entirely suitable for high performance networking applications even if that was not the creator's original objective (a credit to Robert Ramey's skill).
No tool is suitable for all purposes. So figure out your requirements and do some testing to see what works best before choosing a solution. Just because boost::serialization works great for me in a particular application doesn't mean it's going to work great for someone else with a different set of requirements. Also, talking about performance cost/overhead is pointless without precise quantification. Run your own tests in the context of your anticipated usage and see how it works out.
daniel
[1] www.igfip.com: All interprocess communication and object serialization uses boost::serialization. Play a game of Reversi or Chess (against the computer or another player) or chat with another player and see if boost::serialization in any way impacts the real-time/instantaneous response to your actions. Behind the scenes, boost::serialization's impact on CPU time isn't even measurable.
It is quite slow when you need speed though. You will not notice it in those times, but compared to other methods it tends to be many many orders of magnitude slower. It is the registery that slows it down though (I have profiled it, AMD Code Analyst). It is, however, *wonderful* for like save/load functionality, I still use it for that, but for heavy network utilization on never idle programs (say a real-time 3d action game), I never would. Use the proper tools for the proper purposes. :)
participants (1)
-
OvermindDL1