summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-03-18 22:09:00 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-03-18 22:09:00 +0000
commit94579ec02f1b9cf90a2ef40dcb9d66ce8dce85e2 (patch)
tree73f127aa97e76b351d693fcb5816690e465f1f9c /searchlib
parent3a785aa5363cb143a04988b39975f33431a54bf4 (diff)
Use vespalib::hash_set instead of std::set to reduce number of allocation and epeed it up. Also use faster 2^N AND based hash tables.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/fef/properties.h7
-rw-r--r--searchlib/src/vespa/searchlib/fef/rank_program.cpp3
-rw-r--r--searchlib/src/vespa/searchlib/fef/rank_program.h5
3 files changed, 9 insertions, 6 deletions
diff --git a/searchlib/src/vespa/searchlib/fef/properties.h b/searchlib/src/vespa/searchlib/fef/properties.h
index 1cbc0ba9064..377926509bd 100644
--- a/searchlib/src/vespa/searchlib/fef/properties.h
+++ b/searchlib/src/vespa/searchlib/fef/properties.h
@@ -129,9 +129,10 @@ public:
class Properties
{
private:
- typedef vespalib::string Key;
- typedef Property::Values Value;
- typedef vespalib::hash_map<Key, Value> Map;
+ using Key = vespalib::string;
+ using Value = Property::Values;
+ using Map = vespalib::hash_map<Key, Value, vespalib::hash<Key>,
+ std::equal_to<>, vespalib::hashtable_base::and_modulator>;
uint32_t _numValues;
Map _data;
diff --git a/searchlib/src/vespa/searchlib/fef/rank_program.cpp b/searchlib/src/vespa/searchlib/fef/rank_program.cpp
index 48a9c7be147..0bc85a63ceb 100644
--- a/searchlib/src/vespa/searchlib/fef/rank_program.cpp
+++ b/searchlib/src/vespa/searchlib/fef/rank_program.cpp
@@ -3,6 +3,7 @@
#include "rank_program.h"
#include "featureoverrider.h"
#include <vespa/vespalib/locale/c.h>
+#include <vespa/vespalib/stllike/hash_set.hpp>
#include <algorithm>
#include <cassert>
@@ -14,7 +15,6 @@ using vespalib::Stash;
namespace search::fef {
using MappedValues = std::map<const NumberOrObject *, LazyValue>;
-using ValueSet = std::set<const NumberOrObject *>;
namespace {
@@ -179,6 +179,7 @@ RankProgram::setup(const MatchData &md,
const auto &specs = _resolver->getExecutorSpecs();
_executors.reserve(specs.size());
+ _is_const.resize(specs.size()*2); // Reserve space in hashmap for executors to be const
for (uint32_t i = 0; i < specs.size(); ++i) {
vespalib::ArrayRef<NumberOrObject> outputs = _hot_stash.create_array<NumberOrObject>(specs[i].output_types.size());
StashSelector stash(_hot_stash, _cold_stash);
diff --git a/searchlib/src/vespa/searchlib/fef/rank_program.h b/searchlib/src/vespa/searchlib/fef/rank_program.h
index aa6f77abce4..15b7912bfb1 100644
--- a/searchlib/src/vespa/searchlib/fef/rank_program.h
+++ b/searchlib/src/vespa/searchlib/fef/rank_program.h
@@ -10,7 +10,7 @@
#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/util/array.h>
#include <vespa/vespalib/util/stash.h>
-#include <set>
+#include <vespa/vespalib/stllike/hash_set.h>
namespace search::fef {
@@ -31,7 +31,8 @@ private:
RankProgram &operator=(const RankProgram &) = delete;
using MappedValues = std::map<const NumberOrObject *, LazyValue>;
- using ValueSet = std::set<const NumberOrObject *>;
+ using ValueSet = vespalib::hash_set<const NumberOrObject *, vespalib::hash<const NumberOrObject *>,
+ std::equal_to<>, vespalib::hashtable_base::and_modulator>;
BlueprintResolver::SP _resolver;
vespalib::Stash _hot_stash;