diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-03-02 13:50:55 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-03-05 13:05:02 +0000 |
commit | 79eb4da646da25b9734a1ae8eb1222d44cc85061 (patch) | |
tree | de92924b68216eb6579b181279128e8b7cc665e7 | |
parent | 3f9ebe010b78feb15b8866b27db615ef9281ee99 (diff) |
Restructure also for multivalue to reduce the number of dynamic cast.
-rw-r--r-- | searchlib/src/vespa/searchlib/features/attributefeature.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/searchlib/src/vespa/searchlib/features/attributefeature.cpp b/searchlib/src/vespa/searchlib/features/attributefeature.cpp index d55db4ba748..d521d728934 100644 --- a/searchlib/src/vespa/searchlib/features/attributefeature.cpp +++ b/searchlib/src/vespa/searchlib/features/attributefeature.cpp @@ -416,12 +416,22 @@ createAttributeExecutor(uint32_t numOutputs, const IAttributeVector *attribute, if (attribute->isStringType()) { return stash.create<AttributeExecutor<ConstCharContent>>(attribute, idx); } else if (attribute->isIntegerType()) { - { MultiValueExecutorCreator<IntegerAttributeTemplate<int32_t>> creator; if (creator.handle(attribute)) return creator.create(stash, idx); } - { MultiValueExecutorCreator<IntegerAttributeTemplate<int64_t>> creator; if (creator.handle(attribute)) return creator.create(stash, idx); } + if (basicType == BasicType::INT32) { + MultiValueExecutorCreator<IntegerAttributeTemplate<int32_t>> creator; + if (creator.handle(attribute)) return creator.create(stash, idx); + } else if (basicType == BasicType::INT64) { + MultiValueExecutorCreator<IntegerAttributeTemplate<int64_t>> creator; + if (creator.handle(attribute)) return creator.create(stash, idx); + } return stash.create<AttributeExecutor<IntegerContent>>(attribute, idx); } else { // FLOAT - { MultiValueExecutorCreator<FloatingPointAttributeTemplate<double>> creator; if (creator.handle(attribute)) return creator.create(stash, idx); } - { MultiValueExecutorCreator<FloatingPointAttributeTemplate<float>> creator; if (creator.handle(attribute)) return creator.create(stash, idx); } + if (basicType == BasicType::DOUBLE) { + MultiValueExecutorCreator<FloatingPointAttributeTemplate<double>> creator; + if (creator.handle(attribute)) return creator.create(stash, idx); + } else { + MultiValueExecutorCreator<FloatingPointAttributeTemplate<float>> creator; + if (creator.handle(attribute)) return creator.create(stash, idx); + } return stash.create<AttributeExecutor<FloatContent>>(attribute, idx); } } |