From 527e6cbc727e57e33d9152c99def2d6df7c7c96e Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Wed, 14 Jan 2015 18:14:55 +0100 Subject: [PATCH] xor fast hash storage: reorder initialization of elements, delete default c'tor, resetting of table may be expensive as it is rare --- data_structures/xor_fast_hash_storage.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/data_structures/xor_fast_hash_storage.hpp b/data_structures/xor_fast_hash_storage.hpp index c2ad6c13b..3da95e7c2 100644 --- a/data_structures/xor_fast_hash_storage.hpp +++ b/data_structures/xor_fast_hash_storage.hpp @@ -47,13 +47,15 @@ template class XORFastHashStorage { } - HashCell(const HashCell &other) : key(other.key), id(other.id), time(other.time) {} + HashCell(const HashCell &other) : time(other.key), id(other.id), key(other.time) {} operator Key() const { return key; } void operator=(const Key key_to_insert) { key = key_to_insert; } }; + XORFastHashStorage() = delete; + explicit XORFastHashStorage(size_t) : positions(2 << 16), current_timestamp(0) {} HashCell &operator[](const NodeID node) @@ -86,12 +88,11 @@ template class XORFastHashStorage if (std::numeric_limits::max() == current_timestamp) { positions.clear(); - // positions.resize((2 << 16)); + positions.resize(2 << 16); } } private: - XORFastHashStorage() : positions(2 << 16), current_timestamp(0) {} std::vector positions; XORFastHash fast_hasher; unsigned current_timestamp;