File tree Expand file tree Collapse file tree 4 files changed +9
-6
lines changed Expand file tree Collapse file tree 4 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -846,6 +846,7 @@ non_fbcode_target(
846846 exported_deps = [
847847 "//third-party/fmt:fmt" ,
848848 "//xplat/folly:cpu_id" ,
849+ "//xplat/folly:hash_rapidhash" ,
849850 "//xplat/folly:hash_spooky_hash_v2" ,
850851 "//xplat/folly:likely" ,
851852 "//xplat/folly:portability" ,
@@ -7424,6 +7425,7 @@ fbcode_target(
74247425 ":traits" ,
74257426 "//folly/detail:range_common" ,
74267427 "//folly/detail:range_simd" ,
7428+ "//folly/hash:rapidhash" ,
74277429 "//folly/hash:spooky_hash_v2" ,
74287430 "//folly/lang:c_string" ,
74297431 "//folly/lang:exception" ,
Original file line number Diff line number Diff line change 3939
4040#include < folly/Portability.h>
4141#include < folly/hash/SpookyHashV2.h>
42+ #include < folly/hash/rapidhash.h>
4243#include < folly/lang/CString.h>
4344#include < folly/lang/Exception.h>
4445#include < folly/portability/Constexpr.h>
@@ -794,7 +795,7 @@ class Range {
794795 }
795796
796797 // 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
798799 // a 64-bit hash, which means dramatically fewer collisions in large maps.
799800 // (The above advice does not apply if you are targeting a 32-bit system.)
800801 //
@@ -1698,7 +1699,7 @@ struct hasher<
16981699 // may be == without being bit-identical. size_t is less than 64
16991700 // bits on some platforms.
17001701 return static_cast <size_t >(
1701- hash::SpookyHashV2::Hash64 (r.begin (), r.size () * sizeof (T), 0 ));
1702+ folly::hash::rapidhashNano (r.begin (), r.size () * sizeof (T)));
17021703 }
17031704};
17041705
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ fbcode_target(
4747 headers = ["Hash.h" ],
4848 exported_deps = [
4949 ":murmur_hash" ,
50+ ":rapidhash" ,
5051 ":spooky_hash_v1" ,
5152 ":spooky_hash_v2" ,
5253 "//folly:c_portability" ,
Original file line number Diff line number Diff line change 4646#include < folly/hash/MurmurHash.h>
4747#include < folly/hash/SpookyHashV1.h>
4848#include < folly/hash/SpookyHashV2.h>
49+ #include < folly/hash/rapidhash.h>
4950#include < folly/lang/Bits.h>
5051
5152namespace folly {
@@ -999,8 +1000,7 @@ struct hasher<std::string> {
9991000 using folly_is_avalanching = std::true_type;
10001001
10011002 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 ()));
10041004 }
10051005};
10061006template <typename K>
@@ -1011,8 +1011,7 @@ struct hasher<std::string_view> {
10111011 using folly_is_avalanching = std::true_type;
10121012
10131013 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 ()));
10161015 }
10171016};
10181017template <typename K>
You can’t perform that action at this time.
0 commit comments