File tree Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -846,6 +846,7 @@ non_fbcode_target(
846
846
exported_deps = [
847
847
"//third-party/fmt:fmt" ,
848
848
"//xplat/folly:cpu_id" ,
849
+ "//xplat/folly:hash_rapidhash" ,
849
850
"//xplat/folly:hash_spooky_hash_v2" ,
850
851
"//xplat/folly:likely" ,
851
852
"//xplat/folly:portability" ,
@@ -4744,6 +4745,7 @@ non_fbcode_target(
4744
4745
deps = [
4745
4746
":functional_apply_tuple" ,
4746
4747
":hash_murmur_hash" ,
4748
+ ":hash_rapidhash" ,
4747
4749
":hash_spooky_hash_v1" ,
4748
4750
":hash_spooky_hash_v2" ,
4749
4751
":traits" ,
@@ -7419,6 +7421,7 @@ fbcode_target(
7419
7421
":traits" ,
7420
7422
"//folly/detail:range_common" ,
7421
7423
"//folly/detail:range_simd" ,
7424
+ "//folly/hash:rapidhash" ,
7422
7425
"//folly/hash:spooky_hash_v2" ,
7423
7426
"//folly/lang:c_string" ,
7424
7427
"//folly/lang:exception" ,
Original file line number Diff line number Diff line change 39
39
40
40
#include < folly/Portability.h>
41
41
#include < folly/hash/SpookyHashV2.h>
42
+ #include < folly/hash/rapidhash.h>
42
43
#include < folly/lang/CString.h>
43
44
#include < folly/lang/Exception.h>
44
45
#include < folly/portability/Constexpr.h>
@@ -794,7 +795,7 @@ class Range {
794
795
}
795
796
796
797
// Do NOT use this function, which was left behind for backwards
797
- // compatibility. Use SpookyHashV2 instead -- it is faster, and produces
798
+ // compatibility. Use rapidhashNano instead -- it is faster, and produces
798
799
// a 64-bit hash, which means dramatically fewer collisions in large maps.
799
800
// (The above advice does not apply if you are targeting a 32-bit system.)
800
801
//
@@ -1697,8 +1698,8 @@ struct hasher<
1697
1698
// can contain pointers and padding. Also, floating point numbers
1698
1699
// may be == without being bit-identical. size_t is less than 64
1699
1700
// bits on some platforms.
1700
- return static_cast <size_t >(
1701
- hash::SpookyHashV2::Hash64 (r.begin (), r.size () * sizeof (T), 0 ));
1701
+ return static_cast <size_t >(folly::hash::rapidhashNano (
1702
+ reinterpret_cast < const char *> (r.begin ()) , r.size () * sizeof (T)));
1702
1703
}
1703
1704
};
1704
1705
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ fbcode_target(
47
47
headers = ["Hash.h" ],
48
48
exported_deps = [
49
49
":murmur_hash" ,
50
+ ":rapidhash" ,
50
51
":spooky_hash_v1" ,
51
52
":spooky_hash_v2" ,
52
53
"//folly:c_portability" ,
Original file line number Diff line number Diff line change 46
46
#include < folly/hash/MurmurHash.h>
47
47
#include < folly/hash/SpookyHashV1.h>
48
48
#include < folly/hash/SpookyHashV2.h>
49
+ #include < folly/hash/rapidhash.h>
49
50
#include < folly/lang/Bits.h>
50
51
51
52
namespace folly {
@@ -999,8 +1000,7 @@ struct hasher<std::string> {
999
1000
using folly_is_avalanching = std::true_type;
1000
1001
1001
1002
size_t operator ()(const std::string& key) const {
1002
- return static_cast <size_t >(
1003
- hash::SpookyHashV2::Hash64 (key.data (), key.size (), 0 ));
1003
+ return static_cast <size_t >(hash::rapidhashNano (key.data (), key.size ()));
1004
1004
}
1005
1005
};
1006
1006
template <typename K>
@@ -1011,8 +1011,7 @@ struct hasher<std::string_view> {
1011
1011
using folly_is_avalanching = std::true_type;
1012
1012
1013
1013
size_t operator ()(const std::string_view& key) const {
1014
- return static_cast <size_t >(
1015
- hash::SpookyHashV2::Hash64 (key.data (), key.size (), 0 ));
1014
+ return static_cast <size_t >(hash::rapidhashNano (key.data (), key.size ()));
1016
1015
}
1017
1016
};
1018
1017
template <typename K>
You can’t perform that action at this time.
0 commit comments