Skip to content

Commit

Permalink
Revert "Switch to FxHasher for 32bit values"
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Zentrik committed Dec 20, 2023
1 parent 487b0e3 commit e1b6f7a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,13 @@ extern JL_DLLEXPORT _Atomic(uint64_t) jl_cumulative_recompile_time;

STATIC_INLINE uint32_t jl_int32hash_fast(uint32_t a)
{
return a * 0x9e3779b9;
// a = (a+0x7ed55d16) + (a<<12);
// a = (a^0xc761c23c) ^ (a>>19);
// a = (a+0x165667b1) + (a<<5);
// a = (a+0xd3a2646c) ^ (a<<9);
// a = (a+0xfd7046c5) + (a<<3);
// a = (a^0xb55a4f09) ^ (a>>16);
return a; // identity hashing seems to work well enough here
}


Expand Down
8 changes: 7 additions & 1 deletion src/support/hashing.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ extern "C" {

uint32_t int32hash(uint32_t a)
{
return a * 0x9e3779b9;
a = (a+0x7ed55d16) + (a<<12);
a = (a^0xc761c23c) ^ (a>>19);
a = (a+0x165667b1) + (a<<5);
a = (a+0xd3a2646c) ^ (a<<9);
a = (a+0xfd7046c5) + (a<<3);
a = (a^0xb55a4f09) ^ (a>>16);
return a;
}

// FxHasher
Expand Down

0 comments on commit e1b6f7a

Please sign in to comment.