aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2020-10-01 13:50:28 +0200
committerArne Juul <arnej@verizonmedia.com>2020-10-01 12:03:32 +0000
commitbc7d96c789907e29046f491d428f08d837a4a02a (patch)
tree43220b4684ff6272a6d7a76a58fb32cdbff1dff0 /searchlib/src
parent430f72a630a997b6d13bb5870e843d72db6982d4 (diff)
add builder reserve() calls some obvious places
Diffstat (limited to 'searchlib/src')
-rw-r--r--searchlib/src/vespa/searchlib/features/tensor_from_attribute_executor.h1
-rw-r--r--searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/features/tensor_from_weighted_set_feature.cpp1
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();