summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-05-22 14:38:46 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-05-22 14:38:46 +0000
commit1c5d8ba183621e3f101b8f16eae7fcfb4c22f808 (patch)
tree055e3d576cdc0fc423973da69e39dd0ec8c69a63 /searchcore
parent38601194dc7ece53e180005f10f26c3858956ce6 (diff)
Use a smallvector to avoid indirection in most common case, and reserve some space upfront
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/matching/querynodes_test.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp3
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/querynodes.h2
3 files changed, 5 insertions, 4 deletions
diff --git a/searchcore/src/tests/proton/matching/querynodes_test.cpp b/searchcore/src/tests/proton/matching/querynodes_test.cpp
index 15fcc8a3fd7..3c9220bcdb8 100644
--- a/searchcore/src/tests/proton/matching/querynodes_test.cpp
+++ b/searchcore/src/tests/proton/matching/querynodes_test.cpp
@@ -520,9 +520,9 @@ TEST("requireThatSimpleIntermediatesGetProperBlending") {
TEST("control query nodes size") {
EXPECT_EQUAL(160u, sizeof(search::query::NumberTerm));
- EXPECT_EQUAL(192u, sizeof(ProtonNodeTypes::NumberTerm));
+ EXPECT_EQUAL(280u, sizeof(ProtonNodeTypes::NumberTerm));
EXPECT_EQUAL(160u, sizeof(search::query::StringTerm));
- EXPECT_EQUAL(192u, sizeof(ProtonNodeTypes::StringTerm));
+ EXPECT_EQUAL(280u, sizeof(ProtonNodeTypes::StringTerm));
}
} // namespace
diff --git a/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp b/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp
index 03e15830ac5..68845cf7f7f 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp
@@ -23,7 +23,7 @@ struct Mixer {
Mixer() : attributes() {}
void addAttribute(Blueprint::UP attr) {
- if (attributes.get() == 0) {
+ if ( ! attributes) {
attributes = std::make_unique<OrBlueprint>();
}
attributes->addChild(std::move(attr));
@@ -62,6 +62,7 @@ private:
void buildChildren(IntermediateBlueprint &parent,
const std::vector<search::query::Node *> &children)
{
+ parent.reserve(children.size());
for (size_t i = 0; i < children.size(); ++i) {
parent.addChild(BlueprintBuilder::build(_requestContext, *children[i], _context));
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/querynodes.h b/searchcore/src/vespa/searchcore/proton/matching/querynodes.h
index 03b274b7233..0e01884d504 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/querynodes.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/querynodes.h
@@ -44,7 +44,7 @@ public:
};
private:
- std::vector<FieldEntry> _fields;
+ vespalib::SmallVector<FieldEntry, 1u> _fields;
void propagate_document_frequency(uint32_t matching_count_doc, uint32_t total_doc_count);