Skip to content

Commit cd4c983

Browse files
committed
Revert "Switch to FxHasher for 32bit values"
This reverts commit 80ee622. We have a perf regression since first commit, I've had trouble getting reliable benchmarking results so reverting this in case this caused a regression.
1 parent 657cb1b commit cd4c983

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/julia_internal.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,13 @@ extern JL_DLLEXPORT _Atomic(uint64_t) jl_cumulative_recompile_time;
278278

279279
STATIC_INLINE uint32_t jl_int32hash_fast(uint32_t a)
280280
{
281-
return a * 0x9e3779b9;
281+
// a = (a+0x7ed55d16) + (a<<12);
282+
// a = (a^0xc761c23c) ^ (a>>19);
283+
// a = (a+0x165667b1) + (a<<5);
284+
// a = (a+0xd3a2646c) ^ (a<<9);
285+
// a = (a+0xfd7046c5) + (a<<3);
286+
// a = (a^0xb55a4f09) ^ (a>>16);
287+
return a; // identity hashing seems to work well enough here
282288
}
283289

284290

src/support/hashing.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ extern "C" {
1616

1717
uint32_t int32hash(uint32_t a)
1818
{
19-
return a * 0x9e3779b9;
19+
a = (a+0x7ed55d16) + (a<<12);
20+
a = (a^0xc761c23c) ^ (a>>19);
21+
a = (a+0x165667b1) + (a<<5);
22+
a = (a+0xd3a2646c) ^ (a<<9);
23+
a = (a+0xfd7046c5) + (a<<3);
24+
a = (a^0xb55a4f09) ^ (a>>16);
25+
return a;
2026
}
2127

2228
// FxHasher

0 commit comments

Comments
 (0)