diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-06-16 11:32:49 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2019-06-16 11:32:49 +0000 |
commit | 1719073e3780c7524803f215af18f3c2189aec1d (patch) | |
tree | e11c682f758d951089b227c9ef9726d96f402525 | |
parent | c506af97ddcb0dfcc544d58032b748a9aa0e5b5e (diff) |
Enable inlining of small frequent method calls.
-rw-r--r-- | searchlib/src/vespa/searchlib/attribute/enumcomparator.h | 29 | ||||
-rw-r--r-- | searchlib/src/vespa/searchlib/features/rankingexpressionfeature.cpp | 4 |
2 files changed, 13 insertions, 20 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/enumcomparator.h b/searchlib/src/vespa/searchlib/attribute/enumcomparator.h index 4cd446352d0..255d0bead9f 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumcomparator.h +++ b/searchlib/src/vespa/searchlib/attribute/enumcomparator.h @@ -27,13 +27,18 @@ public: /** * Creates a comparator using the given enum store. **/ - EnumStoreComparatorT(const EnumStoreType & enumStore); + EnumStoreComparatorT(const EnumStoreType & enumStore) + : _enumStore(enumStore), + _value() + {} /** * Creates a comparator using the given enum store and that uses the * given value during compare if the enum index is invalid. **/ - EnumStoreComparatorT(const EnumStoreType & enumStore, - EntryValue value); + EnumStoreComparatorT(const EnumStoreType & enumStore, EntryValue value) + : _enumStore(enumStore), + _value(value) + {} static int compare(EntryValue lhs, EntryValue rhs) { if (lhs < rhs) { @@ -60,7 +65,7 @@ private: typedef typename ParentType::EnumIndex EnumIndex; typedef typename ParentType::EntryValue EntryValue; using ParentType::getValue; - bool _prefix; + bool _prefix; size_t _prefixLen; public: /** @@ -90,22 +95,6 @@ public: } }; - -template <typename EntryType> -EnumStoreComparatorT<EntryType>::EnumStoreComparatorT(const EnumStoreType & enumStore) : - _enumStore(enumStore), - _value() -{ -} - -template <typename EntryType> -EnumStoreComparatorT<EntryType>::EnumStoreComparatorT(const EnumStoreType & enumStore, - EntryValue value) : - _enumStore(enumStore), - _value(value) -{ -} - template <> int EnumStoreComparatorT<NumericEntryType<float> >::compare(EntryValue lhs, EntryValue rhs); diff --git a/searchlib/src/vespa/searchlib/features/rankingexpressionfeature.cpp b/searchlib/src/vespa/searchlib/features/rankingexpressionfeature.cpp index b2c8c64d55a..ec71ab528a7 100644 --- a/searchlib/src/vespa/searchlib/features/rankingexpressionfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/rankingexpressionfeature.cpp @@ -134,10 +134,14 @@ CompiledRankingExpressionExecutor::execute(uint32_t) //----------------------------------------------------------------------------- +namespace { + using Context = fef::FeatureExecutor::Inputs; double resolve_input(void *ctx, size_t idx) { return ((const Context *)(ctx))->get_number(idx); } Context *make_ctx(const Context &inputs) { return const_cast<Context *>(&inputs); } +} + LazyCompiledRankingExpressionExecutor::LazyCompiledRankingExpressionExecutor(const CompiledFunction &compiled_function) : _ranking_function(compiled_function.get_lazy_function()) { |