Boost logo

Boost Users :

Subject: [Boost-users] [Serialization] std::set<std::string> restore performance
From: Soumen (soumen78_at_[hidden])
Date: 2010-04-07 03:30:11


Recently we're profiling our tool for restoration for a large electronic
design. And we're restoring two archive of same number of elements - one
uses vector as container while the other uses set. And it appears that
restoration of set is much much slower than the vector. Both the restoration
called from same parent which is called just once. And vector restoration
took 2% of parent while set restoration took 83% of parent. And most of set
restoration time is spent in :

boost::serialization::stl::archive_input_unique<boost::archive::binary_iarchive,
std::set<std::string<char, std::char_traits<char>, std::allocator<char>>,
std::less<std::string<char, std::char_traits<char>, std::allocator<char>>>,
std::allocator<std::string<char, std::char_traits<char>,
std::allocator<char>>> > >::operator ()(boost::archive::binary_iarchive&,
std::set<std::string<char, std::char_traits<char>, std::allocator<char>>,
std::less<std::string<char, std::char_traits<char>, std::allocator<char>>>,
std::allocator<std::string<char, std::char_traits<char>,
std::allocator<char>>> >&, unsigned)

Distribution to callers:
128886 times
boost::serialization::stl::load_collection<boost::archive::binary_iarchive,
std::set<std::string<char, std::char_traits<char>, std::allocator<char>>,
std::less<std::string<char, std::char_traits<char>, std::allocator<char>>>,
std::allocator<std::string<char, std::char_traits<char>,
std::allocator<char>>> >,
boost::serialization::stl::archive_input_unique<boost::archive::binary_iarchive,
std::set<std::string<char, std::char_traits<char>, std::allocator<char>>,
std::less<std::string<char, std::char_traits<char>, std::allocator<char>>>,
std::allocator<std::string<char, std::char_traits<char>,
std::allocator<char>>> > >,
boost::serialization::stl::no_reserve_imp<std::set<std::string<char,
std::char_traits<char>, std::allocator<char>>, std::less<std::string<char,
std::char_traits<char>, std::allocator<char>>>,
std::allocator<std::string<char, std::char_traits<char>,
std::allocator<char>>> >> >(boost::archive::binary_iarchive&,
std::set<std::string<char, std::char_traits<char>, std::alloca

Contributions from descendants:
128886 times (99.98%)
boost::archive::detail::basic_iarchive::reset_object_address( const*,
const*)
128886 times ( 0.01%) std::set<std::string<char, std::char_traits<char>,
std::allocator<char>>, std::less<std::string<char, std::char_traits<char>,
std::allocator<char>>>, std::allocator<std::string<char,
std::char_traits<char>, std::allocator<char>>> >::insert(std::string<char,
std::char_traits<char>, std::allocator<char>> const&)

Is there any known performance problem for std::set<std::string>
restoration? Or do we need to do some special to overcome this performance
problem of std::set<std::string>?

Since we need to use frequent lookup while inserting, we can't switch to
vector. So, can I get better performance with hash_set or tr1::unordered_set
if those are supported for boost::serialization?

We're using 1.35 version of boost.

Regards,
~ Soumen

-- 
View this message in context: http://old.nabble.com/-Serialization--std%3A%3Aset%3Cstd%3A%3Astring%3E-restore-performance-tp28161452p28161452.html
Sent from the Boost - Users mailing list archive at Nabble.com.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net