Boost logo

Boost :

Subject: Re: [boost] [serialization] de-serialization performance issue
From: Robert Ramey (ramey_at_[hidden])
Date: 2011-01-20 01:34:31


Brad Higgins wrote:
> I have encountered a performance issue with serialization, when used
> with multi-index followed by a vector<size_t>. I have a reduced
> program below, which reproduces the issue (using boost 1.44.0).
>
> I basically have a class with a multi-index member, and a
> vector<size_t> member. It serializes OK, but deserialization's
> performance appears to be O(n^2). It seems to be getting bogged down
> in basic_iarchive_impl::reset_object_address(), when deserializing
> the vector. Any thoughts?

> /**
> * Boost serialization hook
> */
> friend class boost::serialization::access;
> template<class Archive>
> void serialize(Archive & ar, const unsigned int version)
> {
> std::cout << "SERIALIZE db_\n";
> ar & boost::serialization::make_nvp("db", db_);
> std::cout << "SERIALIZE vector_ints_\n";
>// ar & boost::serialization::make_nvp("vector_ints",
>// vector_ints_); // <- THIS IS SLOW DURING INPUT }
                FOREACH(size_t x, vector_ints)
                    ar & x
> };
>
what happens if you make the change above? That is, if you substitute
you're
own loop for the boost::serialization implemenation?

Robert Ramey


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