diff options
Diffstat (limited to 'searchlib')
3 files changed, 3 insertions, 0 deletions
diff --git a/searchlib/src/vespa/searchlib/features/tensor_from_attribute_executor.h b/searchlib/src/vespa/searchlib/features/tensor_from_attribute_executor.h index d6175bf57b7..aae3d773820 100644 --- a/searchlib/src/vespa/searchlib/features/tensor_from_attribute_executor.h +++ b/searchlib/src/vespa/searchlib/features/tensor_from_attribute_executor.h @@ -42,6 +42,7 @@ TensorFromAttributeExecutor<WeightedBufferType>::execute(uint32_t docId) { _attrBuffer.fill(*_attribute, docId); vespalib::tensor::DirectSparseTensorBuilder<double> builder(_type); + builder.reserve(_attrBuffer.size()); vespalib::tensor::SparseTensorAddressBuilder address; for (size_t i = 0; i < _attrBuffer.size(); ++i) { address.clear(); diff --git a/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp b/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp index fbeed77e5d0..e6c5f22dd16 100644 --- a/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp @@ -92,6 +92,7 @@ createQueryExecutor(const search::fef::IQueryEnvironment &env, std::vector<vespalib::string> vector; ArrayParser::parse(prop.get(), vector); DirectSparseTensorBuilder<double> tensorBuilder(type); + tensorBuilder.reserve(vector.size()); SparseTensorAddressBuilder address; for (const auto &elem : vector) { address.clear(); diff --git a/searchlib/src/vespa/searchlib/features/tensor_from_weighted_set_feature.cpp b/searchlib/src/vespa/searchlib/features/tensor_from_weighted_set_feature.cpp index a3d0aa1f706..5926c91c7c5 100644 --- a/searchlib/src/vespa/searchlib/features/tensor_from_weighted_set_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/tensor_from_weighted_set_feature.cpp @@ -107,6 +107,7 @@ createQueryExecutor(const search::fef::IQueryEnvironment &env, WeightedStringVector vector; WeightedSetParser::parse(prop.get(), vector); DirectSparseTensorBuilder<double> tensorBuilder(type); + tensorBuilder.reserve(vector._data.size()); SparseTensorAddressBuilder address; for (const auto &elem : vector._data) { address.clear(); |