mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-21 09:10:48 +00:00
Mark lookupResultGetKey/Mapped functions ALWAYS_INLINE.
They only do pointer arithmetics, so it makes sense to always inline them.
This commit is contained in:
parent
f3bde19b74
commit
b949cc232b
@ -15,10 +15,10 @@ struct ClearableHashMapCell : public ClearableHashTableCell<Key, HashMapCell<Key
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename Key, typename Mapped, typename Hash>
|
template<typename Key, typename Mapped, typename Hash>
|
||||||
auto lookupResultGetKey(ClearableHashMapCell<Key, Mapped, Hash> * cell) { return &cell->getFirst(); }
|
ALWAYS_INLINE inline auto lookupResultGetKey(ClearableHashMapCell<Key, Mapped, Hash> * cell) { return &cell->getFirst(); }
|
||||||
|
|
||||||
template<typename Key, typename Mapped, typename Hash>
|
template<typename Key, typename Mapped, typename Hash>
|
||||||
auto lookupResultGetMapped(ClearableHashMapCell<Key, Mapped, Hash> * cell) { return &cell->getSecond(); }
|
ALWAYS_INLINE inline auto lookupResultGetMapped(ClearableHashMapCell<Key, Mapped, Hash> * cell) { return &cell->getSecond(); }
|
||||||
|
|
||||||
template
|
template
|
||||||
<
|
<
|
||||||
|
@ -49,10 +49,10 @@ struct ClearableHashTableCell : public BaseCell
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename Key, typename BaseCell>
|
template<typename Key, typename BaseCell>
|
||||||
auto lookupResultGetKey(ClearableHashTableCell<Key, BaseCell> * cell) { return &cell->key; }
|
ALWAYS_INLINE inline auto lookupResultGetKey(ClearableHashTableCell<Key, BaseCell> * cell) { return &cell->key; }
|
||||||
|
|
||||||
template<typename Key, typename BaseCell>
|
template<typename Key, typename BaseCell>
|
||||||
void * lookupResultGetMapped(ClearableHashTableCell<Key, BaseCell> *) { return nullptr; }
|
ALWAYS_INLINE inline void * lookupResultGetMapped(ClearableHashTableCell<Key, BaseCell> *) { return nullptr; }
|
||||||
|
|
||||||
template
|
template
|
||||||
<
|
<
|
||||||
|
@ -48,10 +48,12 @@ struct FixedHashMapCell
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename Key, typename Mapped, typename State>
|
template<typename Key, typename Mapped, typename State>
|
||||||
void * lookupResultGetKey(FixedHashMapCell<Key, Mapped, State> *) { return nullptr; }
|
ALWAYS_INLINE inline void * lookupResultGetKey(FixedHashMapCell<Key, Mapped, State> *)
|
||||||
|
{ return nullptr; }
|
||||||
|
|
||||||
template<typename Key, typename Mapped, typename State>
|
template<typename Key, typename Mapped, typename State>
|
||||||
auto lookupResultGetMapped(FixedHashMapCell<Key, Mapped, State> * cell) { return &cell->getSecond(); }
|
ALWAYS_INLINE inline auto lookupResultGetMapped(FixedHashMapCell<Key, Mapped, State> * cell)
|
||||||
|
{ return &cell->getSecond(); }
|
||||||
|
|
||||||
template <typename Key, typename Mapped, typename Allocator = HashTableAllocator>
|
template <typename Key, typename Mapped, typename Allocator = HashTableAllocator>
|
||||||
class FixedHashMap : public FixedHashTable<Key, FixedHashMapCell<Key, Mapped>, Allocator>
|
class FixedHashMap : public FixedHashTable<Key, FixedHashMapCell<Key, Mapped>, Allocator>
|
||||||
|
@ -111,10 +111,12 @@ struct HashMapCell
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename Key, typename Mapped, typename Hash, typename State>
|
template<typename Key, typename Mapped, typename Hash, typename State>
|
||||||
auto lookupResultGetKey(HashMapCell<Key, Mapped, Hash, State> * cell) { return &cell->getFirst(); }
|
ALWAYS_INLINE inline auto lookupResultGetKey(HashMapCell<Key, Mapped, Hash, State> * cell)
|
||||||
|
{ return &cell->getFirst(); }
|
||||||
|
|
||||||
template<typename Key, typename Mapped, typename Hash, typename State>
|
template<typename Key, typename Mapped, typename Hash, typename State>
|
||||||
auto lookupResultGetMapped(HashMapCell<Key, Mapped, Hash, State> * cell) { return &cell->getSecond(); }
|
ALWAYS_INLINE inline auto lookupResultGetMapped(HashMapCell<Key, Mapped, Hash, State> * cell)
|
||||||
|
{ return &cell->getSecond(); }
|
||||||
|
|
||||||
|
|
||||||
template <typename Key, typename TMapped, typename Hash, typename TState = HashTableNoState>
|
template <typename Key, typename TMapped, typename Hash, typename TState = HashTableNoState>
|
||||||
@ -135,10 +137,12 @@ struct HashMapCellWithSavedHash : public HashMapCell<Key, TMapped, Hash, TState>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename Key, typename Mapped, typename Hash, typename State>
|
template<typename Key, typename Mapped, typename Hash, typename State>
|
||||||
auto lookupResultGetKey(HashMapCellWithSavedHash<Key, Mapped, Hash, State> * cell) { return &cell->getFirst(); }
|
ALWAYS_INLINE inline auto lookupResultGetKey(HashMapCellWithSavedHash<Key, Mapped, Hash, State> * cell)
|
||||||
|
{ return &cell->getFirst(); }
|
||||||
|
|
||||||
template<typename Key, typename Mapped, typename Hash, typename State>
|
template<typename Key, typename Mapped, typename Hash, typename State>
|
||||||
auto lookupResultGetMapped(HashMapCellWithSavedHash<Key, Mapped, Hash, State> * cell) { return &cell->getSecond(); }
|
ALWAYS_INLINE inline auto lookupResultGetMapped(HashMapCellWithSavedHash<Key, Mapped, Hash, State> * cell)
|
||||||
|
{ return &cell->getSecond(); }
|
||||||
|
|
||||||
|
|
||||||
template <
|
template <
|
||||||
|
@ -85,10 +85,12 @@ struct HashSetCellWithSavedHash : public HashTableCell<Key, Hash, TState>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename Key, typename Hash, typename State>
|
template<typename Key, typename Hash, typename State>
|
||||||
auto lookupResultGetKey(HashSetCellWithSavedHash<Key, Hash, State> * cell) { return &cell->key; }
|
ALWAYS_INLINE inline auto lookupResultGetKey(HashSetCellWithSavedHash<Key, Hash, State> * cell)
|
||||||
|
{ return &cell->key; }
|
||||||
|
|
||||||
template<typename Key, typename Hash, typename State>
|
template<typename Key, typename Hash, typename State>
|
||||||
void * lookupResultGetMapped(HashSetCellWithSavedHash<Key, Hash, State> *) { return nullptr; }
|
ALWAYS_INLINE inline void * lookupResultGetMapped(HashSetCellWithSavedHash<Key, Hash, State> *)
|
||||||
|
{ return nullptr; }
|
||||||
|
|
||||||
template
|
template
|
||||||
<
|
<
|
||||||
|
@ -124,7 +124,7 @@ void set(T & x) { x = 0; }
|
|||||||
* The default implementation of GetMapped that is used for the above case (2).
|
* The default implementation of GetMapped that is used for the above case (2).
|
||||||
*/
|
*/
|
||||||
template<typename PointerLike>
|
template<typename PointerLike>
|
||||||
inline auto lookupResultGetMapped(PointerLike && ptr) { return &*ptr; }
|
ALWAYS_INLINE inline auto lookupResultGetMapped(PointerLike && ptr) { return &*ptr; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic const wrapper for lookupResultGetMapped, that calls a non-const
|
* Generic const wrapper for lookupResultGetMapped, that calls a non-const
|
||||||
@ -132,7 +132,7 @@ inline auto lookupResultGetMapped(PointerLike && ptr) { return &*ptr; }
|
|||||||
* arithmetics.
|
* arithmetics.
|
||||||
*/
|
*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
auto lookupResultGetMapped(const T * obj)
|
ALWAYS_INLINE inline auto lookupResultGetMapped(const T * obj)
|
||||||
{
|
{
|
||||||
auto mapped_ptr = lookupResultGetMapped(const_cast<T *>(obj));
|
auto mapped_ptr = lookupResultGetMapped(const_cast<T *>(obj));
|
||||||
const auto const_mapped_ptr = mapped_ptr;
|
const auto const_mapped_ptr = mapped_ptr;
|
||||||
@ -208,10 +208,12 @@ struct HashTableCell
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename Key, typename Hash, typename State>
|
template<typename Key, typename Hash, typename State>
|
||||||
auto lookupResultGetKey(HashTableCell<Key, Hash, State> * cell) { return &cell->key; }
|
ALWAYS_INLINE inline auto lookupResultGetKey(HashTableCell<Key, Hash, State> * cell)
|
||||||
|
{ return &cell->key; }
|
||||||
|
|
||||||
template<typename Key, typename Hash, typename State>
|
template<typename Key, typename Hash, typename State>
|
||||||
void * lookupResultGetMapped(HashTableCell<Key, Hash, State> *) { return nullptr; }
|
ALWAYS_INLINE inline void * lookupResultGetMapped(HashTableCell<Key, Hash, State> *)
|
||||||
|
{ return nullptr; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A helper function for HashTable::insert() to set the "mapped" value.
|
* A helper function for HashTable::insert() to set the "mapped" value.
|
||||||
|
Loading…
Reference in New Issue
Block a user