Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-01-23 05:43:19


Lo?c Joly wrote:

>>Is it really true? You only need to include this string to archive once:
>>when you've savining polymorphic pointer and static type is equal to
>>dynamic one. One string is not much, and after it's written, everything
>>works as usual. Moreover, if one saves polymorphic pointers and uses
>>BOOST_CLASS_EXPORT, he's likely to have such strings for all derived
>>classes -- so one extra string is not important for performance.
>>
>>
> I the kind of application for which I envision to use
> boost:!serialization, even a per archive overload would be highly
> detrimental to the performances. I plan to use it to package data that
> is to be send as small packages on the network, in a soft real time
> system.

Do you plan to use polimorphic pointers and BOOST_CLASS_EXPORT? If not, than
you'll have no problems.

If, you plan to use both, consider:

   class B { public: virtual ~B() {} };
   class D1 : public B {};
   class D2 : public B {};
   class D3 : public B {};
   BOOST_CLASS_EXPORT(B);
   BOOST_CLASS_EXPORT(D1);
   BOOST_CLASS_EXPORT(D2);
   BOOST_CLASS_EXPORT(D3);

Suppose you're writing all those classes. Under current semantics, you'll
have strings "D1", "D2" and "D3" written to archive at some point, once.
With my proposal, "B" will also be written to archive, once. Is *that*
really important performance-wise?

- Volodya


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk