Fix hashing function in event name mapping in PerformanceEntryReporter (#36682)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36682

## Changelog:

[Internal][Fix] - Fix hashing function in event name mapping in PerformanceEntryReporter

A textbook mistake, when mapping event names via the constant lookup table, only the first 8 characters were effectively taken into account, thus mixing names of some events.

Reviewed By: rubennorte

Differential Revision: D44462195

fbshipit-source-id: 273891d92251014661af731618d8a549627b2983
This commit is contained in:
Ruslan Shestopalyuk
2023-03-28 09:16:36 -07:00
committed by Facebook GitHub Bot
parent 83056947aa
commit 9ccf85e240
@@ -273,10 +273,9 @@ void PerformanceEntryReporter::scheduleFlushBuffer() {
struct StrKey {
uint32_t key;
constexpr StrKey(const char *s)
: key(folly::hash::fnv32_buf(s, sizeof(s) - 1)) {}
StrKey(const char *s) : key(folly::hash::fnv32_buf(s, std::strlen(s))) {}
constexpr bool operator==(const StrKey &rhs) const {
bool operator==(const StrKey &rhs) const {
return key == rhs.key;
}
};