Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions folly/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,7 @@ non_fbcode_target(
exported_deps = [
"//third-party/fmt:fmt",
"//xplat/folly:cpu_id",
"//xplat/folly:hash_rapidhash",
"//xplat/folly:hash_spooky_hash_v2",
"//xplat/folly:likely",
"//xplat/folly:portability",
Expand Down Expand Up @@ -3185,6 +3186,20 @@ non_fbcode_target(
],
)

non_fbcode_target(
_kind = folly_xplat_library,
name = "external_rapidhash",
feature = triage_InfrastructureSupermoduleOptou,
raw_headers = [
"external/rapidhash/rapidhash.h",
],
exported_deps = [
":bits",
":cpp_attributes",
":portability",
],
)

# A basic pieces of folly
# Should only require glog and boost
non_fbcode_target(
Expand Down Expand Up @@ -4336,6 +4351,18 @@ non_fbcode_target(
],
)

non_fbcode_target(
_kind = folly_xplat_library,
name = "hash_rapidhash",
feature = triage_InfrastructureSupermoduleOptou,
raw_headers = [
"hash/rapidhash.h",
],
deps = [
":external_rapidhash",
],
)

non_fbcode_target(
_kind = folly_xplat_library,
name = "logging_init_weak",
Expand Down Expand Up @@ -4719,6 +4746,7 @@ non_fbcode_target(
deps = [
":functional_apply_tuple",
":hash_murmur_hash",
":hash_rapidhash",
":hash_spooky_hash_v1",
":hash_spooky_hash_v2",
":traits",
Expand Down Expand Up @@ -7395,6 +7423,7 @@ fbcode_target(
":traits",
"//folly/detail:range_common",
"//folly/detail:range_simd",
"//folly/hash:rapidhash",
"//folly/hash:spooky_hash_v2",
"//folly/lang:c_string",
"//folly/lang:exception",
Expand Down
7 changes: 4 additions & 3 deletions folly/Range.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

#include <folly/Portability.h>
#include <folly/hash/SpookyHashV2.h>
#include <folly/hash/rapidhash.h>
#include <folly/lang/CString.h>
#include <folly/lang/Exception.h>
#include <folly/portability/Constexpr.h>
Expand Down Expand Up @@ -794,7 +795,7 @@ class Range {
}

// Do NOT use this function, which was left behind for backwards
// compatibility. Use SpookyHashV2 instead -- it is faster, and produces
// compatibility. Use rapidhashNano instead -- it is faster, and produces
// a 64-bit hash, which means dramatically fewer collisions in large maps.
// (The above advice does not apply if you are targeting a 32-bit system.)
//
Expand Down Expand Up @@ -1697,8 +1698,8 @@ struct hasher<
// can contain pointers and padding. Also, floating point numbers
// may be == without being bit-identical. size_t is less than 64
// bits on some platforms.
return static_cast<size_t>(
hash::SpookyHashV2::Hash64(r.begin(), r.size() * sizeof(T), 0));
return static_cast<size_t>(folly::hash::rapidhashNano(
reinterpret_cast<const char*>(r.begin()), r.size() * sizeof(T)));
}
};

Expand Down
14 changes: 14 additions & 0 deletions folly/external/rapidhash/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target")
load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")

oncall("fbcode_entropy_wardens_folly")

fbcode_target(
_kind = cpp_library,
name = "rapidhash",
headers = ["rapidhash.h"],
exported_deps = [
"//folly:cpp_attributes",
"//folly/lang:bits",
],
)
Loading
Loading