Boost logo

Boost :

Subject: Re: [boost] [serialization] de-serialization performance issue
From: Brad Higgins (bhiggins_at_[hidden])
Date: 2011-01-20 15:39:34


If I roll my own, I would not call reset_object_address(), and it would work much faster. The issue is that, for each element in the vector, the default deserialization code is calling reset_object_address(). Due to the deserialization of the large multi-index, reset_object_address() iterates through a list that is very large.

I'll spend more time reading the code, but is there a way to avoid the big hit in reset_object_address(), or avoid the call to it all together?

Thanks,
Brad

On Jan 20, 2011, at 1:34 AM, Robert Ramey wrote:

> 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
>
>
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


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