diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-06-01 20:24:30 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-06-01 20:24:30 +0000 |
commit | 60ed3cb1cf792625f34b3399f0f88190e21eeac1 (patch) | |
tree | c1e8bf6bbfb498217b77b13cf8e3e8dcd92d3e60 /vespalib | |
parent | 068ca168a6d4d22cae6da18ad220fc07cf767acd (diff) |
- Optimize get_tensor_ref optimizing for no branches on happy path.
- Also drop check for reference as that is done in the next called method.
- Inline DirectTensorStore::get_tensor.
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/datastore/datastore.h | 5 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/datastore/datastore.hpp | 9 |
2 files changed, 4 insertions, 10 deletions
diff --git a/vespalib/src/vespa/vespalib/datastore/datastore.h b/vespalib/src/vespa/vespalib/datastore/datastore.h index be74c2a60d5..3ede2ada953 100644 --- a/vespalib/src/vespa/vespalib/datastore/datastore.h +++ b/vespalib/src/vespa/vespalib/datastore/datastore.h @@ -118,7 +118,10 @@ public: ~DataStore(); EntryRef addEntry(const EntryType &e); - const EntryType &getEntry(EntryRef ref) const; + + const EntryType &getEntry(EntryRef ref) const { + return *this->template getEntry<EntryType>(RefType(ref)); + } }; extern template class DataStoreT<EntryRefT<22> >; diff --git a/vespalib/src/vespa/vespalib/datastore/datastore.hpp b/vespalib/src/vespa/vespalib/datastore/datastore.hpp index 23dcb9222a1..e46b6cf111e 100644 --- a/vespalib/src/vespa/vespalib/datastore/datastore.hpp +++ b/vespalib/src/vespa/vespalib/datastore/datastore.hpp @@ -164,15 +164,6 @@ DataStore<EntryType, RefT>::addEntry(const EntryType &e) return FreeListAllocator<EntryType, RefT, NoOpReclaimer>(*this, 0).alloc(e).ref; } -template <typename EntryType, typename RefT> -const EntryType & -DataStore<EntryType, RefT>::getEntry(EntryRef ref) const -{ - RefType intRef(ref); - const EntryType *be = this->template getEntry<EntryType>(intRef); - return *be; -} - extern template class DataStoreT<EntryRefT<22> >; } |