summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-03-09 19:27:58 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2017-03-09 19:27:58 +0100
commit698aa8e731e94ba093d4dc4c2bdbb40d2c66a185 (patch)
treeb9dbd0587ddd664e3aad2c6ee38c43699da60dd3 /searchlib
parent3045f2928b7b23086c48b14ec680cf509e070747 (diff)
Enable inlinining of the most frequent and optimized code path.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/features/dotproductfeature.cpp24
-rw-r--r--searchlib/src/vespa/searchlib/fef/featureexecutor.h5
2 files changed, 17 insertions, 12 deletions
diff --git a/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp b/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp
index b7c10e330ba..043b183d1c8 100644
--- a/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp
+++ b/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp
@@ -7,6 +7,7 @@
#include <vespa/searchlib/fef/properties.h>
#include <vespa/searchlib/attribute/integerbase.h>
#include <vespa/searchlib/attribute/floatbase.h>
+#include <vespa/searchlib/attribute/multinumericattribute.h>
#include <vespa/log/log.h>
LOG_SETUP(".features.dotproduct");
@@ -252,24 +253,31 @@ create(const IAttributeVector * attribute, const Property & prop, vespalib::Stas
if (values.empty()) {
return stash.create<SingleZeroValueExecutor>();
}
- const A & iattr = dynamic_cast<const A &>(*attribute);
+ const A * iattr = dynamic_cast<const A *>(attribute);
if (indexes.empty()) {
try {
- const multivalue::Value<typename A::BaseType> * tmp;
- iattr.getRawValues(0, tmp);
- return stash.create<dotproduct::array::DotProductExecutor<A>>(&iattr, values);
+ using T = typename A::BaseType;
+ using VT = multivalue::Value<T>;
+ const VT * tmp;
+ iattr->getRawValues(0, tmp);
+ using ExactA = MultiValueNumericAttribute<A, VT>;
+ const ExactA * exactA = dynamic_cast<const ExactA *>(iattr);
+ if (exactA != nullptr) {
+ return stash.create<dotproduct::array::DotProductExecutor<ExactA>>(exactA, values);
+ }
+ return stash.create<dotproduct::array::DotProductExecutor<A>>(iattr, values);
} catch (const std::runtime_error & e) {
(void) e;
- return stash.create<dotproduct::array::DotProductByCopyExecutor<A>>(&iattr, values);
+ return stash.create<dotproduct::array::DotProductByCopyExecutor<A>>(iattr, values);
}
} else {
try {
const multivalue::Value<typename A::BaseType> * tmp;
- iattr.getRawValues(0, tmp);
- return stash.create<dotproduct::array::SparseDotProductExecutor<A>>(&iattr, values, indexes);
+ iattr->getRawValues(0, tmp);
+ return stash.create<dotproduct::array::SparseDotProductExecutor<A>>(iattr, values, indexes);
} catch (const std::runtime_error & e) {
(void) e;
- return stash.create<dotproduct::array::SparseDotProductByCopyExecutor<A>>(&iattr, values, indexes);
+ return stash.create<dotproduct::array::SparseDotProductByCopyExecutor<A>>(iattr, values, indexes);
}
}
return stash.create<SingleZeroValueExecutor>();
diff --git a/searchlib/src/vespa/searchlib/fef/featureexecutor.h b/searchlib/src/vespa/searchlib/fef/featureexecutor.h
index 7f604bb851f..e15f3ebb20b 100644
--- a/searchlib/src/vespa/searchlib/fef/featureexecutor.h
+++ b/searchlib/src/vespa/searchlib/fef/featureexecutor.h
@@ -2,14 +2,11 @@
#pragma once
-#include <vector>
-#include <vespa/vespalib/util/linkedptr.h>
#include "handle.h"
#include "matchdata.h"
-#include <cassert>
#include <memory>
-#include <vespa/vespalib/util/array.h>
#include "number_or_object.h"
+#include <vespa/vespalib/util/arrayref.h>
namespace search {
namespace fef {