Skip to content

Commit

Permalink
Faster pair hash for ACM
Browse files Browse the repository at this point in the history
  • Loading branch information
rjoomen authored and Levi-Armstrong committed Mar 4, 2024
1 parent 7a971fb commit 3ef3b93
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tesseract_common/src/types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <tesseract_common/macros.h>
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
#include <boost/functional/hash.hpp>
#include <boost/serialization/access.hpp>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/map.hpp>
Expand All @@ -45,11 +46,10 @@ namespace tesseract_common
{
std::size_t PairHash::operator()(const LinkNamesPair& pair) const
{
thread_local std::string key;
key.clear();
key.append(pair.first);
key.append(pair.second);
return std::hash<std::string>()(key);
std::size_t seed{ 0 };
boost::hash_combine(seed, pair.first);
boost::hash_combine(seed, pair.second);
return seed;
}

LinkNamesPair makeOrderedLinkPair(const std::string& link_name1, const std::string& link_name2)
Expand Down

0 comments on commit 3ef3b93

Please sign in to comment.