From 1862d47ff95d80fbd01ad77d3a79e3283f58603f Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 16 Apr 2024 14:43:23 +0000 Subject: - Optimize distance calculation for tensors with single dense subspace. - Let EmptySubspace be invalid. - Add noexcept to get_tensor(s). --- vespalib/src/vespa/vespalib/datastore/array_store.h | 6 +++--- vespalib/src/vespa/vespalib/datastore/datastore.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'vespalib') diff --git a/vespalib/src/vespa/vespalib/datastore/array_store.h b/vespalib/src/vespa/vespalib/datastore/array_store.h index 4549b81283e..51a1f9fe950 100644 --- a/vespalib/src/vespa/vespalib/datastore/array_store.h +++ b/vespalib/src/vespa/vespalib/datastore/array_store.h @@ -94,7 +94,7 @@ private: EntryRef allocate_dynamic_array(size_t array_size, uint32_t type_id); EntryRef addLargeArray(ConstArrayRef array); EntryRef allocate_large_array(size_t array_size); - ConstArrayRef getSmallArray(RefT ref, size_t arraySize) const { + ConstArrayRef getSmallArray(RefT ref, size_t arraySize) const noexcept { const ElemT *buf = _store.template getEntryArray(ref, arraySize); return ConstArrayRef(buf, arraySize); } @@ -104,7 +104,7 @@ private: auto size = BufferType::get_dynamic_array_size(entry); return ConstArrayRef(entry, size); } - ConstArrayRef getLargeArray(RefT ref) const { + ConstArrayRef getLargeArray(RefT ref) const noexcept { const LargeArray *buf = _store.template getEntry(ref); return ConstArrayRef(&(*buf)[0], buf->size()); } @@ -114,7 +114,7 @@ public: ArrayStore(const ArrayStoreConfig &cfg, std::shared_ptr memory_allocator, TypeMapper&& mapper); ~ArrayStore() override; EntryRef add(ConstArrayRef array); - ConstArrayRef get(EntryRef ref) const { + ConstArrayRef get(EntryRef ref) const noexcept { if (!ref.valid()) [[unlikely]] { return ConstArrayRef(); } diff --git a/vespalib/src/vespa/vespalib/datastore/datastore.h b/vespalib/src/vespa/vespalib/datastore/datastore.h index fa231e9cf94..0226c780cf1 100644 --- a/vespalib/src/vespa/vespalib/datastore/datastore.h +++ b/vespalib/src/vespa/vespalib/datastore/datastore.h @@ -96,7 +96,7 @@ public: EntryRef addEntry(const EntryType &e); - const EntryType &getEntry(EntryRef ref) const { + const EntryType &getEntry(EntryRef ref) const noexcept { return *this->template getEntry(RefType(ref)); } }; -- cgit v1.2.3