summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2018-01-10 16:53:51 +0100
committerGitHub <noreply@github.com>2018-01-10 16:53:51 +0100
commit080cab605506b08501214385f674e9bc594ff57d (patch)
treeac2f91a431f3529a08e93ad59ec71891657abcce
parentae6a93de9fcdd4d8a2cb22d8819bcbf52de64aad (diff)
parent838981a8e3a264dcf6a657a37eec2bfa2b4a1d8f (diff)
Merge pull request #4605 from vespa-engine/balder/use-simple-power-of-2-modulo-hashing
Balder/use simple power of 2 modulo hashing
-rw-r--r--document/src/test/resources/tensor/multi_cell_tensor__cppbin107 -> 107 bytes
-rw-r--r--eval/src/tests/tensor/tensor_slime_serialization/tensor_slime_serialization_test.cpp4
-rw-r--r--eval/src/vespa/eval/tensor/sparse/sparse_tensor.cpp3
-rw-r--r--eval/src/vespa/eval/tensor/sparse/sparse_tensor.h3
4 files changed, 6 insertions, 4 deletions
diff --git a/document/src/test/resources/tensor/multi_cell_tensor__cpp b/document/src/test/resources/tensor/multi_cell_tensor__cpp
index c0b2b3a165a..d4c7c5fbbe5 100644
--- a/document/src/test/resources/tensor/multi_cell_tensor__cpp
+++ b/document/src/test/resources/tensor/multi_cell_tensor__cpp
Binary files differ
diff --git a/eval/src/tests/tensor/tensor_slime_serialization/tensor_slime_serialization_test.cpp b/eval/src/tests/tensor/tensor_slime_serialization/tensor_slime_serialization_test.cpp
index 2b75503c534..e6e6c7de686 100644
--- a/eval/src/tests/tensor/tensor_slime_serialization/tensor_slime_serialization_test.cpp
+++ b/eval/src/tests/tensor/tensor_slime_serialization/tensor_slime_serialization_test.cpp
@@ -63,8 +63,8 @@ vespalib::string twoCellsJson[3] =
"] }",
"{ dimensions: [ 'x', 'y' ],"
" cells: ["
- "{ address: { y:'3'}, value: 4.0 },"
- "{ address: { x:'1'}, value: 3.0 }"
+ "{ address: { x:'1'}, value: 3.0 },"
+ "{ address: { y:'3'}, value: 4.0 }"
"] }",
};
}
diff --git a/eval/src/vespa/eval/tensor/sparse/sparse_tensor.cpp b/eval/src/vespa/eval/tensor/sparse/sparse_tensor.cpp
index b69b1cdab05..1f57e297ea1 100644
--- a/eval/src/vespa/eval/tensor/sparse/sparse_tensor.cpp
+++ b/eval/src/vespa/eval/tensor/sparse/sparse_tensor.cpp
@@ -188,4 +188,5 @@ SparseTensor::reduce(join_fun_t op,
}
-VESPALIB_HASH_MAP_INSTANTIATE(vespalib::tensor::SparseTensorAddressRef, double);
+VESPALIB_HASH_MAP_INSTANTIATE_H_E_M(vespalib::tensor::SparseTensorAddressRef, double, vespalib::hash<vespalib::tensor::SparseTensorAddressRef>,
+ std::equal_to<vespalib::tensor::SparseTensorAddressRef>, vespalib::hashtable_base::and_modulator);
diff --git a/eval/src/vespa/eval/tensor/sparse/sparse_tensor.h b/eval/src/vespa/eval/tensor/sparse/sparse_tensor.h
index 2715e606729..3eeb122f48c 100644
--- a/eval/src/vespa/eval/tensor/sparse/sparse_tensor.h
+++ b/eval/src/vespa/eval/tensor/sparse/sparse_tensor.h
@@ -21,7 +21,8 @@ namespace vespalib::tensor {
class SparseTensor : public Tensor
{
public:
- using Cells = hash_map<SparseTensorAddressRef, double>;
+ using Cells = hash_map<SparseTensorAddressRef, double, hash<SparseTensorAddressRef>,
+ std::equal_to<SparseTensorAddressRef>, hashtable_base::and_modulator>;
static constexpr size_t STASH_CHUNK_SIZE = 16384u;