mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 19:27:11 +03:00
Make a slow code path for std::set FindStringPiece. I had fixed sparse features to use hash tables. But Hieu reverted this and kludged
FindStringPiece to be slow. This change returns my code to being fast and leaves the performance problem to Hieu/Eva.
This commit is contained in:
parent
50652382e9
commit
1c81c5582f
@ -3,6 +3,8 @@
|
||||
|
||||
#include "util/string_piece.hh"
|
||||
|
||||
#include <set>
|
||||
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <boost/version.hpp>
|
||||
|
||||
@ -42,4 +44,14 @@ template <class T> typename T::iterator FindStringPiece(T &t, const StringPiece
|
||||
#endif
|
||||
}
|
||||
|
||||
// Horribly inefficient versions because Hieu undid my changes.
|
||||
template <class Entry, class Compare, class Alloc> typename std::set<Entry, Compare, Alloc>::const_iterator FindStringPiece(const std::set<Entry, Compare, Alloc> &t, const StringPiece &key) {
|
||||
std::string temp(key.data(), key.size());
|
||||
return t.find(temp);
|
||||
}
|
||||
template <class Entry, class Compare, class Alloc> typename std::set<Entry, Compare, Alloc>::iterator FindStringPiece(std::set<Entry, Compare, Alloc> &t, const StringPiece &key) {
|
||||
std::string temp(key.data(), key.size());
|
||||
return t.find(temp);
|
||||
}
|
||||
|
||||
#endif // UTIL_STRING_PIECE_HASH__
|
||||
|
Loading…
Reference in New Issue
Block a user