diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-06-02 11:02:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-02 11:02:31 +0200 |
commit | 7f1903a0daf0eecb448115e94fc57c0a2f098916 (patch) | |
tree | 4830b8d418eb7b1258953506d9a36227dab054c2 /vespalib | |
parent | 55895c9709c812feeebf906521dcdbf600bf8aef (diff) | |
parent | cb0c49bd51bcc4f2396deb8e29647a0110fcabdc (diff) |
Merge pull request #22854 from vespa-engine/balder/inline-tensor-access-methods
- Optimize get_tensor_ref optimizing for no branches on happy path.
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> >; } |