diff options
author | Harald Musum <musum@verizonmedia.com> | 2020-03-20 19:23:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-20 19:23:36 +0100 |
commit | fc0a6eb4a073bca84e0b0da3997bc986646084e9 (patch) | |
tree | 0a355c75b688a1716768b676c604fb14eb0656a8 | |
parent | 59bb8cda4c4bc8aa06b1a1a771a5324d8b36d50e (diff) | |
parent | aec489e80254bcf5d3300e60df568e5c83a11779 (diff) |
Merge pull request #12653 from vespa-engine/revert-12646-balder/make-default-hashing-use-2N-and-instead-of-prime-mod
Revert "Since the most important aspect our use of hash maps/sets is for speeā¦"
9 files changed, 35 insertions, 35 deletions
diff --git a/documentapi/test/crosslanguagefiles/6.221-cpp-CreateVisitorMessage.dat b/documentapi/test/crosslanguagefiles/6.221-cpp-CreateVisitorMessage.dat Binary files differindex a7bb5b0e896..27e64170701 100644 --- a/documentapi/test/crosslanguagefiles/6.221-cpp-CreateVisitorMessage.dat +++ b/documentapi/test/crosslanguagefiles/6.221-cpp-CreateVisitorMessage.dat diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp index 3c3ff863345..c15fd2ccfc1 100644 --- a/searchcore/src/tests/proton/docsummary/docsummary.cpp +++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp @@ -774,8 +774,8 @@ Test::requireThatAttributesAreUsed() "bd:[20,30]," "be:[20.2,30.3]," "bf:['bar','baz']," - "bg:[document_sub{item:40,weight:2},{item:50,weight:3}]," - "bh:[{item:50.5,weight:5},{item:40.4,weight:4}]," + "bg:[{item:50,weight:3},{item:40,weight:2}]," + "bh:[{item:40.4,weight:4},{item:50.5,weight:5}]," "bi:[{item:'quux',weight:7},{item:'qux',weight:6}]," "bj:'0x01020178017901016601674008000000000000'}", *rep, 0, true)); TEST_DO(assertTensor(make_tensor(TensorSpec("tensor(x{},y{})") diff --git a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp index 11054566985..7139eb0d82d 100644 --- a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp +++ b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp @@ -447,8 +447,8 @@ void assertAttributes2(const AttributeGuardList &attributes) { EXPECT_EQUAL(2u, attributes.size()); - EXPECT_EQUAL("attr2", attributes[0]->getName()); - EXPECT_EQUAL("attr1", attributes[1]->getName()); + EXPECT_EQUAL("attr1", attributes[0]->getName()); + EXPECT_EQUAL("attr2", attributes[1]->getName()); } void @@ -544,7 +544,7 @@ requireThatAttributeManagerCanBeReconfigured(Fixture &f) f.basicReconfig(10); std::vector<AttributeGuard> attributes; f.getAttributeManager()->getAttributeList(attributes); - TEST_DO(assertAttributes2(attributes)); + assertAttributes2(attributes); } TEST_F("require that attribute manager can be reconfigured", FastAccessFixture) @@ -791,13 +791,13 @@ assertAttribute(const AttributeGuard &attr, const vespalib::string &name, uint32 void assertAttribute1(const AttributeGuard &attr, SerialNum createSerialNum, SerialNum lastSerialNum) { - TEST_DO(assertAttribute(attr, "attr1", 3, 22, 44, createSerialNum, lastSerialNum)); + assertAttribute(attr, "attr1", 3, 22, 44, createSerialNum, lastSerialNum); } void assertAttribute2(const AttributeGuard &attr, SerialNum createSerialNum, SerialNum lastSerialNum) { - TEST_DO(assertAttribute(attr, "attr2", 3, 33, 55, createSerialNum, lastSerialNum)); + assertAttribute(attr, "attr2", 3, 33, 55, createSerialNum, lastSerialNum); } TEST_F("require that fast-access attributes are populated during feed", FastAccessOnlyFixture) @@ -833,8 +833,8 @@ requireThatAttributesArePopulatedDuringReprocessing(FixtureType &f) std::vector<AttributeGuard> attrs; f.getAttributeManager()->getAttributeList(attrs); EXPECT_EQUAL(2u, attrs.size()); - TEST_DO(assertAttribute1(attrs[1], CFG_SERIAL, 40)); - TEST_DO(assertAttribute2(attrs[0], 40, 40)); + assertAttribute1(attrs[0], CFG_SERIAL, 40); + assertAttribute2(attrs[1], 40, 40); } } diff --git a/searchlib/src/tests/predicate/document_features_store_test.cpp b/searchlib/src/tests/predicate/document_features_store_test.cpp index 72f83e533c9..d817b1668ff 100644 --- a/searchlib/src/tests/predicate/document_features_store_test.cpp +++ b/searchlib/src/tests/predicate/document_features_store_test.cpp @@ -208,9 +208,9 @@ TEST("require that serialization cleans up wordstore") { EXPECT_EQUAL(460u, features_store.getMemoryUsage().usedBytes()); annotations.range_features.push_back({"bar", 100, 199}); features_store.insert(annotations, doc_id + 1); - EXPECT_EQUAL(848u, features_store.getMemoryUsage().usedBytes()); - features_store.remove(doc_id + 1); EXPECT_EQUAL(800u, features_store.getMemoryUsage().usedBytes()); + features_store.remove(doc_id + 1); + EXPECT_EQUAL(752u, features_store.getMemoryUsage().usedBytes()); vespalib::DataBuffer buffer; features_store.serialize(buffer); diff --git a/staging_vespalib/src/vespa/vespalib/stllike/lrucache_map.h b/staging_vespalib/src/vespa/vespalib/stllike/lrucache_map.h index 777230566f2..07137263cf6 100644 --- a/staging_vespalib/src/vespa/vespalib/stllike/lrucache_map.h +++ b/staging_vespalib/src/vespa/vespalib/stllike/lrucache_map.h @@ -28,32 +28,32 @@ struct LinkedValue : public LinkedValueBase template<typename K, typename V, typename H = vespalib::hash<K>, typename EQ = std::equal_to<K> > struct LruParam { - using LV = LinkedValue<V>; - using value_type = std::pair< K, LV >; - using select_key = vespalib::Select1st< value_type >; - using Key = K; - using Value = V; - using Hash = H; - using Equal = EQ; - using HashTable = hashtable< Key, value_type, Hash, Equal, select_key >; + typedef LinkedValue<V> LV; + typedef std::pair< K, LV > value_type; + typedef vespalib::Select1st< value_type > select_key; + typedef K Key; + typedef V Value; + typedef H Hash; + typedef EQ Equal; + typedef hashtable< Key, value_type, Hash, Equal, select_key > HashTable; }; template< typename P > class lrucache_map : private P::HashTable { private: - using HashTable = typename P::HashTable; - using V = typename P::Value; - using K = typename P::Key; - using value_type = typename P::value_type; - using LV = typename P::LV; - using internal_iterator = typename HashTable::iterator; - using next_t = typename HashTable::next_t; - using NodeStore = typename HashTable::NodeStore; + typedef typename P::HashTable HashTable; + typedef typename P::Value V; + typedef typename P::Key K; + typedef typename P::value_type value_type; + typedef typename P::LV LV; + typedef typename HashTable::iterator internal_iterator; + typedef typename HashTable::next_t next_t; + typedef typename HashTable::NodeStore NodeStore; protected: static constexpr size_t UNLIMITED = std::numeric_limits<size_t>::max(); public: - using insert_result = typename HashTable::insert_result; + typedef typename HashTable::insert_result insert_result; class iterator { public: @@ -177,8 +177,8 @@ public: void swap(lrucache_map & rhs); private: - using MoveRecord = std::pair<uint32_t, uint32_t>; - using MoveRecords = std::vector<MoveRecord>; + typedef std::pair<uint32_t, uint32_t> MoveRecord; + typedef std::vector<MoveRecord> MoveRecords; /** * Implements the resize of the hashtable */ diff --git a/staging_vespalib/src/vespa/vespalib/stllike/lrucache_map.hpp b/staging_vespalib/src/vespa/vespalib/stllike/lrucache_map.hpp index d8d55c9b8c4..61147229497 100644 --- a/staging_vespalib/src/vespa/vespalib/stllike/lrucache_map.hpp +++ b/staging_vespalib/src/vespa/vespalib/stllike/lrucache_map.hpp @@ -74,7 +74,7 @@ lrucache_map<P>::lrucache_map(size_t maxElems) : { } template< typename P > -lrucache_map<P>::~lrucache_map() = default; +lrucache_map<P>::~lrucache_map() { } template< typename P > void diff --git a/vespalib/src/vespa/vespalib/stllike/hash_map.h b/vespalib/src/vespa/vespalib/stllike/hash_map.h index 29a5ef01a9f..3dc5de65285 100644 --- a/vespalib/src/vespa/vespalib/stllike/hash_map.h +++ b/vespalib/src/vespa/vespalib/stllike/hash_map.h @@ -7,7 +7,7 @@ namespace vespalib { -template< typename K, typename V, typename H = vespalib::hash<K>, typename EQ = std::equal_to<>, typename M=hashtable_base::and_modulator > +template< typename K, typename V, typename H = vespalib::hash<K>, typename EQ = std::equal_to<>, typename M=hashtable_base::prime_modulator > class hash_map { public: diff --git a/vespalib/src/vespa/vespalib/stllike/hash_set.h b/vespalib/src/vespa/vespalib/stllike/hash_set.h index 0c3f2dcb220..08288086bf3 100644 --- a/vespalib/src/vespa/vespalib/stllike/hash_set.h +++ b/vespalib/src/vespa/vespalib/stllike/hash_set.h @@ -8,7 +8,7 @@ namespace vespalib { -template< typename K, typename H = vespalib::hash<K>, typename EQ = std::equal_to<>, typename M=hashtable_base::and_modulator> +template< typename K, typename H = vespalib::hash<K>, typename EQ = std::equal_to<>, typename M=hashtable_base::prime_modulator> class hash_set { private: diff --git a/vespalib/src/vespa/vespalib/stllike/hash_set.hpp b/vespalib/src/vespa/vespalib/stllike/hash_set.hpp index 3e48e62f2c7..19114798806 100644 --- a/vespalib/src/vespa/vespalib/stllike/hash_set.hpp +++ b/vespalib/src/vespa/vespalib/stllike/hash_set.hpp @@ -85,11 +85,11 @@ hash_set<K, H, EQ, M>::insert(K &&value) { #define VESPALIB_HASH_SET_INSTANTIATE(K) \ template class vespalib::hash_set<K>; \ - template class vespalib::hashtable<K, K, vespalib::hash<K>, std::equal_to<>, vespalib::Identity, vespalib::hashtable_base::and_modulator>; \ + template class vespalib::hashtable<K, K, vespalib::hash<K>, std::equal_to<>, vespalib::Identity>; \ template class vespalib::Array<vespalib::hash_node<K>>; #define VESPALIB_HASH_SET_INSTANTIATE_H(K, H) \ template class vespalib::hash_set<K, H>; \ - template class vespalib::hashtable<K, K, H, std::equal_to<>, vespalib::Identity, vespalib::hashtable_base::and_modulator>; \ + template class vespalib::hashtable<K, K, H, std::equal_to<>, vespalib::Identity>; \ template class vespalib::Array<vespalib::hash_node<K>>; |