$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: [boost] [filesystem] operator == performance
From: Konstantin Litvinenko (to.darkangel_at_[hidden])
Date: 2009-01-17 06:11:05
Hi!
I am developing an application with very intensive
boost::filesystem::path usage. At certain moment application start to be
slowly and I start profiler. Profiler shows me that
std::map<fs:path, ....>
is painfully slow due path::operator <() that do
lexicographical compare
, that do
void iterator_helper<Path>::do_increment( iterator & itr )
that is really slow.
So I have replaced std::map on boost::unordered_map.. and didn't get
expected performance gain. Profiles show me that path::operator <() hit
count 200000 and now only 100000. That tooooo much. Further
investigation shows that problem was path::operator ==() used in
unordered_map. I understand that operator == can be implemented using
strict weak ordering concept, but for filesystem::path. Why not
implement it as:
bool path::operator == (const path& lhs, const path& rhs) const
{
return lhs.string() == rhs.string();
}
?