Skip to content

add hash(Integer) fast-path#49998

Closed
oscardssmith wants to merge 1 commit intoJuliaLang:masterfrom
oscardssmith:faster-Integer-hash
Closed

add hash(Integer) fast-path#49998
oscardssmith wants to merge 1 commit intoJuliaLang:masterfrom
oscardssmith:faster-Integer-hash

Conversation

@oscardssmith
Copy link
Copy Markdown
Member

Previously this used the hash(Real) path which is a bunch slower since the decomposition needs a lot more normalization and the conditions for when the fast-paths were applicable were more complicated.

# Before
@btime hash(x, UInt(1234)) setup=(x=Int128(rand(Int)))
 12.390 ns (0 allocations: 0 bytes)

julia> @btime hash(x, UInt(1234)) setup=(x=rand(Int128))
 23.768 ns (0 allocations: 0 bytes)

#After
julia> @btime hash(x, UInt(1234)) setup=(x=Int128(rand(Int)))
 5.039 ns (0 allocations: 0 bytes)

julia> @btime hash(x, UInt(1234)) setup=(x=rand(Int128))
 17.538 ns (0 allocations: 0 bytes)

@oscardssmith
Copy link
Copy Markdown
Member Author

Closing since #49996 gets the same performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant