
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